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 Dec 14, 2023
1 parent efeabf6 commit e5fdb20
Show file tree
Hide file tree
Showing 8 changed files with 615 additions and 2,045 deletions.
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:outdir": "yarn outdir:prepare && yarn test --outDir='public' && yarn outdir:revert",
"test": "vitest",
"test:outdir": "yarn outdir:prepare && yarn test --dir='public' && yarn outdir:revert",
"outdir:prepare": "mv build public",
"outdir:revert": "mv public build",
"test:coverage": "jest --collect-coverage",
"test:coverage": "vitest run --coverage",
"postinstall": "npx husky install && 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 @@ -37,24 +37,23 @@
"devDependencies": {
"@babel/preset-typescript": "^7.23.3",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.11",
"@types/minimist": "^1.2.5",
"@types/node": "20.10.4",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@vitest/coverage-c8": "^0.30.1",
"eslint": "^8.55.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.3",
"jest": "^29.7.0",
"npm-prepare-dist": "^0.4.1",
"prettier": "^3.1.1",
"pretty-quick": "^3.1.3",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"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 e5fdb20

Please sign in to comment.