Skip to content

Commit

Permalink
Use vitest workspace to explicitly define tests
Browse files Browse the repository at this point in the history
Simplifies test run commands - no need to know the configs.
  • Loading branch information
webfiltered committed Dec 19, 2024
1 parent f215c52 commit 70161d9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"sign": "node debug/sign.js",
"start": "node ./scripts/launchdev.js",
"test:e2e": "npx playwright test",
"test:unit": "vitest run --config vite.main.config.ts",
"test:unit": "vitest run",
"test:update-snapshots": "npx playwright test --update-snapshots",
"todesktop:afterPack": "./scripts/todesktop/afterPack.cjs",
"todesktop:beforeInstall": "./scripts/todesktop/beforeInstall.cjs",
Expand Down
1 change: 1 addition & 0 deletions vite.main.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default defineConfig((env) => {
mainFields: ['module', 'jsnext:main', 'jsnext'],
},
test: {
name: 'main',
include: ['tests/unit/**/*'],
},
};
Expand Down
5 changes: 5 additions & 0 deletions vite.preload.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export default defineConfig((env) => {
},
},
},
test: {
name: 'preload',
include: ['tests/preload/**/*'],
environment: 'jsdom',
},
};

return mergeConfig(getBuildConfig(env), config);
Expand Down
10 changes: 10 additions & 0 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineWorkspace } from 'vitest/config';

export default defineWorkspace([
{
extends: './vite.main.config.ts',
},
{
extends: './vite.preload.config.ts',
},
]);

0 comments on commit 70161d9

Please sign in to comment.