Skip to content

Commit b5430cb

Browse files
committed
02/05: add defaultConfig.exclude step to instructions
1 parent 538ad6a commit b5430cb

File tree

1 file changed

+14
-4
lines changed
  • exercises/02.vitest-browser-mode/05.problem.multiple-workspaces

1 file changed

+14
-4
lines changed

exercises/02.vitest-browser-mode/05.problem.multiple-workspaces/vite.config.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/// <reference types="vitest" />
22
import { defineConfig } from 'vite'
3+
// 🐨 Import `defaultConfig` from `vitest/config`
4+
// 💰 import { foo } from 'bar'
35
import react from '@vitejs/plugin-react'
46

57
export default defineConfig({
@@ -14,11 +16,19 @@ export default defineConfig({
1416
//
1517
// 🐨 In the unit test workspace, set `globals` to true
1618
// and `environment` to "node".
19+
// 💰 globals: true
20+
// 💰 environment: 'node'
1721
//
18-
// 🐨 Finally, declare `include` and `exclude` properties
19-
// that decide which test suites to run.
20-
// Use the "**/*.test.ts" pattern for `include`
21-
// and "**/*.browser.test.ts(x)?" pattern for `exclude.
22+
// 🐨 Add the `include` property and set it to an array
23+
// with the only entry "**/*.test.ts".
24+
//
25+
// 🐨 Since "**/*.test.ts" will match ALL tests, exclude
26+
// the browser tests by providing the `exclude` property
27+
// and including the browser test pattern there.
28+
// 🦉 Vitest workspaces override the default configuration,
29+
// which means that the `exclude` array must include the
30+
// default values to ignore tests from `node_modules`, for example.
31+
// 💰 exclude: [...defaultConfig.exclude, '**/*.browser.test.ts(x)?']
2232
//
2333
// 🐨 Now, switch to the second entry in the `workspace`
2434
// array. There, give it the following properties:

0 commit comments

Comments
 (0)