Skip to content

Commit

Permalink
Merge pull request #42 from bartholomej/vitest
Browse files Browse the repository at this point in the history
Vitest
  • Loading branch information
bartholomej authored Jan 5, 2025
2 parents 60ea817 + 8a1e928 commit cb8e4c7
Show file tree
Hide file tree
Showing 9 changed files with 1,122 additions and 710 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: yarn build

- name: Run tests
run: yarn test --coverage true
run: yarn test:coverage

- name: Run tests with outDir
run: yarn test:outdir
Expand Down
203 changes: 0 additions & 203 deletions jest.config.ts

This file was deleted.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"tsc": "tsc",
"demo": "tsx demo",
"lint": "eslint ./src/**/**/* --fix",
"test": "jest",
"test": "vitest",
"test:outdir": "yarn outdir:prepare && OUT_DIR='public' yarn test && yarn outdir:revert",
"outdir:prepare": "mv build public",
"outdir:revert": "mv public build",
"test:coverage": "jest --collect-coverage",
"test:coverage": "vitest run --coverage",
"postinstall": "cp -r ./src/build/ ./build",
"postversion": "git push && git push --follow-tags",
"publish:next": "yarn && yarn build && yarn test && cd dist && npm publish --tag next",
Expand All @@ -38,11 +38,11 @@
"devDependencies": {
"@babel/preset-typescript": "^7.26.0",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.14",
"@types/minimist": "^1.2.5",
"@types/node": "22.10.5",
"@typescript-eslint/eslint-plugin": "^8.19.0",
"@typescript-eslint/parser": "^8.19.0",
"@vitest/coverage-v8": "2.1.8",
"eslint": "^9.17.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -53,10 +53,9 @@
"prettier": "^3.4.2",
"pretty-quick": "^4.0.0",
"rimraf": "^6.0.1",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tsx": "^4.19.2",
"typescript": "^5.7.2"
"typescript": "^5.7.2",
"vitest": "^2.1.8"
},
"publishConfig": {
"access": "public",
Expand All @@ -83,4 +82,4 @@
"node": ">= 14.17.0"
},
"license": "MIT"
}
}
3 changes: 2 additions & 1 deletion tests/files.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { existsSync, mkdirSync, readFileSync, rmdirSync } from 'fs';
import { describe, expect, test } from 'vitest';
import { version } from '../package.json';
import { writeSitemap } from '../src/helpers/global.helper';
import { CHUNK } from '../src/vars';
import { deleteFolderIfExist, TEST_FOLDER } from './utils-test';
import { TEST_FOLDER, deleteFolderIfExist } from './utils-test';

describe('Creating files', () => {
const json = [
Expand Down
1 change: 1 addition & 0 deletions tests/helper.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest';
import { removeHtml } from '../src/helpers/global.helper';

describe('Remove html', () => {
Expand Down
1 change: 1 addition & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest';
import { prepareData } from '../src/helpers/global.helper';
import { optionsTest, sortbyPage } from './utils-test';

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "es2017",
"lib": ["dom"],
"types": ["node", "jest"],
"types": ["node"],
"baseUrl": "./src",
"esModuleInterop": true,
"module": "commonjs",
Expand Down
21 changes: 21 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
coverage: {
provider: 'v8', // or 'istanbul'
exclude: [
'**/node_modules/**',
'**/demo.ts',
'**/index.ts',
'**/dist/**',
'**/config/**',
'**/*.config.{js,ts}',
'**/*.test.{js,ts,jsx,tsx}',
'**/*.d.ts',
'**/vars.helper.ts',
'**/tests/**'
]
}
}
});
Loading

0 comments on commit cb8e4c7

Please sign in to comment.