Skip to content

Commit

Permalink
feat(vitest) use vitest instead of react-scripts for tests
Browse files Browse the repository at this point in the history
Signed-off-by: David Edler <david.edler@canonical.com>
  • Loading branch information
edlerd committed Jan 23, 2024
1 parent 7c11daf commit 3e0e143
Show file tree
Hide file tree
Showing 11 changed files with 979 additions and 7,519 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"hooks-remove": "husky uninstall",
"start": "concurrently --kill-others --raw 'vite --host | grep -v 3000' 'yarn serve'",
"serve": "./entrypoint",
"test-js": "react-scripts test src/ --watchAll=false"},
"test-js": "vitest --run"},
"dependencies": {
"@canonical/react-components": "0.47.3",
"@monaco-editor/react": "4.6.0",
Expand All @@ -37,7 +37,6 @@
"react-cytoscapejs": "2.0.0",
"react-dom": "18.2.0",
"react-router-dom": "6.21.3",
"react-scripts": "5.0.1",
"react-useportal": "1.0.19",
"serve": "14.2.1",
"vanilla-framework": "4.6.0",
Expand Down Expand Up @@ -89,7 +88,8 @@
"ts-loader": "9.5.1",
"typescript": "5.3.3",
"vite": "4.5.2",
"vite-tsconfig-paths": "4.3.1"
"vite-tsconfig-paths": "4.3.1",
"vitest": "1.2.1"
},
"lint-staged": {
"src/**/*.{json,jsx,ts,tsx}": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": false,
"sourceMap": true
"sourceMap": true,
"types": ["vitest/globals"]
},
"include": [
"./src",
Expand All @@ -35,6 +36,7 @@
"playwright.config.ts",
"webpack.config.js",
"./tests/*.ts",
"vite.config.ts"
"vite.config.ts",
"vitest.config.ts"
],
}
12 changes: 12 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { mergeConfig, defineConfig } from "vitest/config";
import viteConfig from "./vite.config";

export default mergeConfig(
viteConfig,
defineConfig({
test: {
globals: true,
include: ["./src/**/*.spec.{ts,tsx}"],
},
}),
);
8,474 changes: 960 additions & 7,514 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 3e0e143

Please sign in to comment.