Skip to content

Commit 2122ffd

Browse files
authored
fix: propagate --maxWorkers to projects (#11102)
1 parent 58f02ae commit 2122ffd

3 files changed

Lines changed: 37 additions & 21 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const PROJECT_CLI_OVERRIDES = [
6565
'inspect',
6666
'inspectBrk',
6767
'fileParallelism',
68+
'maxWorkers',
6869
'tagsFilter',
6970
'browser',
7071
'experimental',

test/e2e/test/projects.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,21 @@ describe('nested projects', () => {
685685
expect(ctx!.projects.map(project => project.config.testTimeout)).toEqual([999])
686686
})
687687

688+
it('cli --maxWorkers reaches projects', async () => {
689+
const { stderr, ctx } = await runInlineTests({
690+
'vitest.config.js': {
691+
test: {
692+
projects: [
693+
{ test: { name: 'unit' } },
694+
],
695+
},
696+
},
697+
'basic.test.js': basicTest,
698+
}, { $cliOptions: { maxWorkers: 3 } })
699+
expect(stderr).toBe('')
700+
expect(ctx!.projects.map(project => project.config.maxWorkers)).toEqual([3])
701+
})
702+
688703
it('benchmark projects are created for nested projects', async () => {
689704
const { stderr, ctx } = await runInlineTests({
690705
'vitest.config.js': {

test/e2e/test/reporters/merge-reports.test.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -876,22 +876,22 @@ test("works on browser", () => {
876876
mergeReports: resolve(root, '.vitest/blob'),
877877
})
878878
expect(trimReporterOutput(result.stdout)).toMatchInlineSnapshot(`
879-
"✓ |node| linux basic.test.ts > always good <time>
880-
✓ |node| linux basic.test.ts > works on node <time>
881-
× |node| linux basic.test.ts > works on browser <time>
882-
→ expected 'undefined' not to be 'undefined' // Object.is equality
883-
✓ |browser (chromium)| linux basic.test.ts > always good <time>
879+
"✓ |browser (chromium)| linux basic.test.ts > always good <time>
884880
× |browser (chromium)| linux basic.test.ts > works on node <time>
885881
→ expected 'object' to be 'undefined' // Object.is equality
886882
✓ |browser (chromium)| linux basic.test.ts > works on browser <time>
887-
✓ |node| macos basic.test.ts > always good <time>
888-
✓ |node| macos basic.test.ts > works on node <time>
889-
× |node| macos basic.test.ts > works on browser <time>
883+
✓ |node| linux basic.test.ts > always good <time>
884+
✓ |node| linux basic.test.ts > works on node <time>
885+
× |node| linux basic.test.ts > works on browser <time>
890886
→ expected 'undefined' not to be 'undefined' // Object.is equality
891887
✓ |browser (chromium)| macos basic.test.ts > always good <time>
892888
× |browser (chromium)| macos basic.test.ts > works on node <time>
893889
→ expected 'object' to be 'undefined' // Object.is equality
894890
✓ |browser (chromium)| macos basic.test.ts > works on browser <time>
891+
✓ |node| macos basic.test.ts > always good <time>
892+
✓ |node| macos basic.test.ts > works on node <time>
893+
× |node| macos basic.test.ts > works on browser <time>
894+
→ expected 'undefined' not to be 'undefined' // Object.is equality
895895
896896
Test Files 4 failed (4)
897897
Tests 4 failed | 8 passed (12)
@@ -902,19 +902,6 @@ test("works on browser", () => {
902902
"
903903
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 4 ⎯⎯⎯⎯⎯⎯⎯
904904
905-
FAIL |node| linux basic.test.ts > works on browser
906-
FAIL |node| macos basic.test.ts > works on browser
907-
AssertionError: expected 'undefined' not to be 'undefined' // Object.is equality
908-
❯ basic.test.ts:11:29
909-
9|
910-
10| test("works on browser", () => {
911-
11| expect(typeof window).not.toBe('undefined')
912-
| ^
913-
12| })
914-
13|
915-
916-
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯
917-
918905
FAIL |browser (chromium)| linux basic.test.ts > works on node
919906
AssertionError: expected 'object' to be 'undefined' // Object.is equality
920907
@@ -929,6 +916,19 @@ test("works on browser", () => {
929916
8| })
930917
9|
931918
919+
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯
920+
921+
FAIL |node| linux basic.test.ts > works on browser
922+
FAIL |node| macos basic.test.ts > works on browser
923+
AssertionError: expected 'undefined' not to be 'undefined' // Object.is equality
924+
❯ basic.test.ts:11:29
925+
9|
926+
10| test("works on browser", () => {
927+
11| expect(typeof window).not.toBe('undefined')
928+
| ^
929+
12| })
930+
13|
931+
932932
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯
933933
934934
FAIL |browser (chromium)| macos basic.test.ts > works on node

0 commit comments

Comments
 (0)