Skip to content

Commit

Permalink
chore(test): migrate from jest to vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
bartholomej committed Aug 20, 2024
1 parent 2c26e13 commit 61febe4
Show file tree
Hide file tree
Showing 8 changed files with 949 additions and 532 deletions.
203 changes: 0 additions & 203 deletions jest.config.ts

This file was deleted.

9 changes: 5 additions & 4 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.24.7",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.12",
"@types/minimist": "^1.2.5",
"@types/node": "22.4.1",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"@vitest/coverage-c8": "^0.30.1",
"eslint": "^9.9.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -55,7 +55,8 @@
"rimraf": "^5.0.9",
"ts-jest": "^29.2.4",
"tsx": "^4.17.0",
"typescript": "^5.5.4"
"typescript": "^5.5.4",
"vitest": "^0.30.1"
},
"publishConfig": {
"access": "public",
Expand Down
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
9 changes: 9 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
coverage: {
provider: 'c8'
}
}
});
Loading

0 comments on commit 61febe4

Please sign in to comment.