-
-
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(browser): correctly update inline snapshot if changed (#5925)
- Loading branch information
1 parent
489785d
commit 2380cb9
Showing
20 changed files
with
201 additions
and
50 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
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
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
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
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
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 |
---|---|---|
@@ -1,5 +1,2 @@ | ||
export * from '@vitest/utils' | ||
|
||
export function loadSourceMapUtils() { | ||
return import('@vitest/utils/source-map') | ||
} | ||
export * from '@vitest/utils/source-map' |
1 change: 1 addition & 0 deletions
1
test/browser/fixtures/update-snapshot/__snapshots__/custom/my_snapshot
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 @@ | ||
my snapshot content |
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,27 @@ | ||
import { expect, test, vi } from 'vitest' | ||
|
||
interface _BasicInterface { | ||
willBeRemoved: boolean | ||
leavingSourceMapIncorrect: boolean | ||
} | ||
|
||
test('inline snapshot', () => { | ||
expect(1).toMatchInlineSnapshot('1') | ||
}) | ||
|
||
test('basic', () => { | ||
expect(1).toMatchSnapshot() | ||
}) | ||
|
||
test('renders inline mock snapshot', () => { | ||
const fn = vi.fn() | ||
expect(fn).toMatchInlineSnapshot() | ||
fn('hello', 'world', 2) | ||
expect(fn).toMatchInlineSnapshot() | ||
}) | ||
|
||
test('file snapshot', async () => { | ||
await expect('my snapshot content') | ||
.toMatchFileSnapshot('./__snapshots__/custom/my_snapshot') | ||
}) | ||
|
This file was deleted.
Oops, something went wrong.
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
48 changes: 48 additions & 0 deletions
48
test/browser/specs/__snapshots__/update-snapshot.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,48 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`update snapshot 1`] = ` | ||
"import { expect, test, vi } from 'vitest' | ||
interface _BasicInterface { | ||
willBeRemoved: boolean | ||
leavingSourceMapIncorrect: boolean | ||
} | ||
test('inline snapshot', () => { | ||
expect(1).toMatchInlineSnapshot('1') | ||
}) | ||
test('basic', () => { | ||
expect(1).toMatchSnapshot() | ||
}) | ||
test('renders inline mock snapshot', () => { | ||
const fn = vi.fn() | ||
expect(fn).toMatchInlineSnapshot(\`[MockFunction spy]\`) | ||
fn('hello', 'world', 2) | ||
expect(fn).toMatchInlineSnapshot(\` | ||
[MockFunction spy] { | ||
"calls": [ | ||
[ | ||
"hello", | ||
"world", | ||
2, | ||
], | ||
], | ||
"results": [ | ||
{ | ||
"type": "return", | ||
"value": undefined, | ||
}, | ||
], | ||
} | ||
\`) | ||
}) | ||
test('file snapshot', async () => { | ||
await expect('my snapshot content') | ||
.toMatchFileSnapshot('./__snapshots__/custom/my_snapshot') | ||
}) | ||
" | ||
`; |
Oops, something went wrong.