GeezerVison is showing github.com — fix: inherit `watch` from the root config in projects (#11724) · vitest-dev/vitest@77c122c
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/vitest/src/node/config
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/vitest/src/node/config/resolveConfig.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -231,6 +231,7 @@ export function resolveTestConfig( |
231 | 231 | resolved.coverage = globalConfig.coverage |
232 | 232 | resolved.attachmentsDir = globalConfig.attachmentsDir |
233 | 233 | resolved.mergeReportsLabel = globalConfig.mergeReportsLabel |
| 234 | + resolved.watch = globalConfig.watch |
234 | 235 | } |
235 | 236 |
|
236 | 237 | const rootStats = statSync(resolved.root, { throwIfNoEntry: false }) |
|
Collapse file
Copy file name to clipboardExpand all lines: test/e2e/test/projects.test.ts +19Lines changed: 19 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -161,6 +161,25 @@ describe('the root config inheritance', () => { |
161 | 161 | expect(ctx!.projects.map((project) => project.config.projects)).toEqual([undefined, undefined]) |
162 | 162 | }) |
163 | 163 |
|
| 164 | + it.for([true, false])('projects inherit watch from the root config (watch %s)', async (watch) => { |
| 165 | + const { stderr, ctx } = await runInlineTests( |
| 166 | + { |
| 167 | + 'vitest.config.js': { |
| 168 | + test: { |
| 169 | + projects: [ |
| 170 | + { test: { name: 'inherited' } }, |
| 171 | + { extends: false, test: { name: 'isolated' } }, |
| 172 | + ], |
| 173 | + }, |
| 174 | + }, |
| 175 | + 'basic.test.js': basicTest, |
| 176 | + }, |
| 177 | + { watch }, |
| 178 | + ) |
| 179 | + expect(stderr).toBe('') |
| 180 | + expect(ctx!.projects.map((project) => project.config.watch)).toEqual([watch, watch]) |
| 181 | + }) |
| 182 | + |
164 | 183 | it('the root name and globalSetup are not inherited by the projects', async () => { |
165 | 184 | const { stderr, ctx, fs } = await runInlineTests({ |
166 | 185 | 'globalSetup.js': ts` |
|