-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vitest): pass down CLI options to override workspace configs (#4774)
- Loading branch information
1 parent
184f4cc
commit 8dabef8
Showing
6 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
test/config/fixtures/workspace-flags/projects/cli-config.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { it, expect } from 'vitest'; | ||
|
||
it('math', () => { | ||
expect(1).toBe(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default ['projects'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { expect, it } from 'vitest' | ||
import { runVitest } from '../../test-utils' | ||
|
||
it('correctly inherit from the cli', async () => { | ||
const { vitest } = await runVitest({ | ||
root: 'fixtures/workspace-flags', | ||
logHeapUsage: true, | ||
allowOnly: true, | ||
sequence: { | ||
seed: 123, | ||
}, | ||
testTimeout: 5321, | ||
pool: 'forks', | ||
globals: true, | ||
expandSnapshotDiff: true, | ||
retry: 6, | ||
testNamePattern: 'math', | ||
passWithNoTests: true, | ||
bail: 100, | ||
}) | ||
const project = vitest!.projects[0] | ||
const config = project.getSerializableConfig() | ||
expect(config).toMatchObject({ | ||
logHeapUsage: true, | ||
allowOnly: true, | ||
sequence: expect.objectContaining({ | ||
seed: 123, | ||
}), | ||
testTimeout: 5321, | ||
pool: 'forks', | ||
globals: true, | ||
expandSnapshotDiff: true, | ||
retry: 6, | ||
passWithNoTests: true, | ||
bail: 100, | ||
}) | ||
expect(config.testNamePattern?.test('math')).toBe(true) | ||
}) |