-
-
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): delegate snapshot options to workspace from root config (#…
- Loading branch information
Showing
6 changed files
with
39 additions
and
1 deletion.
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
3 changes: 3 additions & 0 deletions
3
test/snapshots/test/fixtures/workspace/packages/space/test/__snapshots__/basic.test.ts.snap
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,3 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`basic 1`] = `1`; |
5 changes: 5 additions & 0 deletions
5
test/snapshots/test/fixtures/workspace/packages/space/test/basic.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 { test, expect } from "vitest" | ||
|
||
test("basic", () => { | ||
expect(1).toMatchSnapshot() | ||
}) |
5 changes: 5 additions & 0 deletions
5
test/snapshots/test/fixtures/workspace/packages/space/vite.config.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 { defineProject } from 'vitest/config' | ||
|
||
export default defineProject({ | ||
test: {}, | ||
}) |
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 { defineWorkspace } from 'vitest/config' | ||
|
||
export default defineWorkspace([ | ||
'packages/*', | ||
]) |
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,19 @@ | ||
import { expect, test } from 'vitest' | ||
import { editFile, runVitest } from '../../test-utils' | ||
|
||
test('--update works for workspace project', async () => { | ||
// setup wrong snapshot value | ||
editFile( | ||
'test/fixtures/workspace/packages/space/test/__snapshots__/basic.test.ts.snap', | ||
data => data.replace('`1`', '`2`'), | ||
) | ||
|
||
// run with --update | ||
const { stdout, exitCode } = await runVitest({ | ||
update: true, | ||
root: 'test/fixtures/workspace', | ||
workspace: 'vitest.workspace.ts', | ||
}) | ||
expect.soft(stdout).include('Snapshots 1 updated') | ||
expect.soft(exitCode).toBe(0) | ||
}) |