Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1500654

Browse files
authored
fix(browser): support fileParallelism on an instance (#9328)
1 parent 1246e03 commit 1500654

File tree

2 files changed

+25
-0
lines changed
  • packages/vitest/src/node/projects
    • resolveProjects.ts
  • test/config/test
    • browser-configs.test.ts

2 files changed

+25
-0
lines changed

packages/vitest/src/node/projects/resolveProjects.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ function cloneConfig(project: TestProject, { browser, ...config }: BrowserInstan
253253
headless,
254254
screenshotDirectory,
255255
screenshotFailures,
256+
fileParallelism,
256257
// @ts-expect-error remove just in case
257258
browser: _browser,
258259
name,
@@ -276,6 +277,7 @@ function cloneConfig(project: TestProject, { browser, ...config }: BrowserInstan
276277
screenshotFailures: screenshotFailures ?? currentConfig.screenshotFailures,
277278
headless: headless ?? currentConfig.headless,
278279
provider: provider ?? currentConfig.provider,
280+
fileParallelism: fileParallelism ?? currentConfig.fileParallelism,
279281
name: browser,
280282
instances: [], // projects cannot spawn more configs
281283
},

test/config/test/browser-configs.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,29 @@ test('provider options can be changed dynamically in CLI', async () => {
533533
})
534534
})
535535

536+
test('fileParallelism on the instance works properly', async () => {
537+
const v = await vitest({}, {
538+
fileParallelism: true,
539+
browser: {
540+
enabled: true,
541+
provider: playwright(),
542+
instances: [
543+
{
544+
browser: 'chromium',
545+
fileParallelism: false,
546+
},
547+
{
548+
browser: 'firefox',
549+
fileParallelism: true,
550+
},
551+
],
552+
},
553+
})
554+
expect(v.projects).toHaveLength(2)
555+
expect(v.projects[0].config.browser.fileParallelism).toBe(false)
556+
expect(v.projects[1].config.browser.fileParallelism).toBe(true)
557+
})
558+
536559
function getCliConfig(options: TestUserConfig, cli: string[], fs: TestFsStructure = {}) {
537560
const root = resolve(process.cwd(), `vitest-test-${crypto.randomUUID()}`)
538561
useFS(root, {

0 commit comments

Comments
(0)