Skip to content

Commit 77c122c

Browse files
nstepienclaude
andauthored
fix: inherit watch from the root config in projects (#11724)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent d7c7ffc commit 77c122c

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎packages/vitest/src/node/config/resolveConfig.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ export function resolveTestConfig(
231231
resolved.coverage = globalConfig.coverage
232232
resolved.attachmentsDir = globalConfig.attachmentsDir
233233
resolved.mergeReportsLabel = globalConfig.mergeReportsLabel
234+
resolved.watch = globalConfig.watch
234235
}
235236

236237
const rootStats = statSync(resolved.root, { throwIfNoEntry: false })

‎test/e2e/test/projects.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,25 @@ describe('the root config inheritance', () => {
161161
expect(ctx!.projects.map((project) => project.config.projects)).toEqual([undefined, undefined])
162162
})
163163

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+
164183
it('the root name and globalSetup are not inherited by the projects', async () => {
165184
const { stderr, ctx, fs } = await runInlineTests({
166185
'globalSetup.js': ts`

0 commit comments

Comments
 (0)