Skip to content

Commit

Permalink
Merge pull request #838 from L4Ph/jest-to-vitest
Browse files Browse the repository at this point in the history
Migrate Jest to Vitest
  • Loading branch information
yoichiro authored Jun 1, 2024
2 parents 9df211c + 61a337b commit 2b2db9c
Show file tree
Hide file tree
Showing 4 changed files with 884 additions and 6,243 deletions.
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"type-check": "tsc --noEmit",
"lint": "eslint src --ext .ts,.tsx",
"build": "yarn type-check && yarn lint && vite build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"test": "vitest",
"format": "prettier --write './src/**/*.{ts,tsx}'",
"gen-types": "json2ts src/services/storage/assets/keyboard-definition-schema.json --style.singleQuote > src/gen/types/KeyboardDefinition.ts;",
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006 -s public",
Expand Down Expand Up @@ -82,7 +81,6 @@
"@types/ajv": "^1.0.0",
"@types/axios": "^0.14.0",
"@types/downloadjs": "^1.4.2",
"@types/jest": "^26.0.15",
"@types/lodash": "^4.14.167",
"@types/node": "^14.14.22",
"@types/prop-types": "^15.7.4",
Expand All @@ -98,20 +96,21 @@
"@types/wicg-file-system-access": "^2020.9.7",
"@typescript-eslint/eslint-plugin": "^4.10.0",
"@typescript-eslint/parser": "^7.11.0",
"@vitejs/plugin-react": "^4.3.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"babel-eslint": "^10.1.0",
"eslint": "8.57.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.21.5",
"happy-dom": "^14.12.0",
"husky": "^4.3.6",
"json-schema-to-typescript": "^10.1.2",
"lint-staged": "^10.5.3",
"prettier": "^3.2.5",
"react-scripts": "^4.0.1",
"sinon": "^11.1.2",
"vite": "^5.2.12",
"vite-plugin-node-polyfills": "^0.22.0"
"vite-plugin-node-polyfills": "^0.22.0",
"vitest": "^1.6.0"
},
"husky": {
"hooks": {
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"typeRoots": ["node_modules/@types", "node_modules", "src/@types"],
"types": [
"node",
"@types/jest",
"@types/w3c-web-hid",
"@types/w3c-web-usb",
"@types/w3c-web-serial",
"@types/wicg-file-system-access",
"vite/client"
"vite/client",
"vitest/globals"
]
},
"include": ["src"]
Expand Down
8 changes: 7 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import react from '@vitejs/plugin-react';
/// <reference types="vitest" />
import react from '@vitejs/plugin-react-swc';
import { defineConfig, Plugin, loadEnv } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';

Expand All @@ -15,6 +16,11 @@ export default defineConfig(({ mode }) => {
server: {
port: 3000,
},
test: {
globals: true,
environment: 'happy-dom',
setupFiles: 'setupTests.ts',
},
};
});

Expand Down
Loading

0 comments on commit 2b2db9c

Please sign in to comment.