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 Jan 5, 2025
1 parent 08112fc commit 1974ae8
Show file tree
Hide file tree
Showing 8 changed files with 972 additions and 616 deletions.
203 changes: 0 additions & 203 deletions jest.config.ts

This file was deleted.

10 changes: 5 additions & 5 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-c8": "^0.30.1",
"eslint": "^9.17.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -53,9 +53,9 @@
"prettier": "^3.4.2",
"pretty-quick": "^4.0.0",
"rimraf": "^6.0.1",
"ts-jest": "^29.2.5",
"tsx": "^4.19.2",
"typescript": "^5.7.2"
"typescript": "^5.7.2",
"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 1974ae8

Please sign in to comment.