-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
feat: browserIssues and PRs related to the browser runnerIssues and PRs related to the browser runnerp3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
See #5278 (comment)
Currently inline snapshot update is not working due to #5263, but even after the fix #5278, it's still not working when slowHijackESM: true for a different reason.
It looks like there's something wrong with stacktrace and it's not finding the right position. I was debug logging around here:
vitest/packages/snapshot/src/port/state.ts
Lines 125 to 133 in 4ff7159
| private _addSnapshot( | |
| key: string, | |
| receivedSerialized: string, | |
| options: { isInline: boolean; rawSnapshot?: RawSnapshotInfo; error?: Error }, | |
| ): void { | |
| this._dirty = true | |
| if (options.isInline) { | |
| const stacks = parseErrorStacktrace(options.error || new Error('snapshot'), { ignoreStackEntries: [] }) | |
| const stack = this._inferInlineSnapshotStack(stacks) |
Reproduction
- Replace the following code with
expect(2).toMatchInlineSnapshot('1'):
vitest/test/browser/test/snapshot.test.ts
Lines 3 to 5 in 4ff7159
| test('inline snapshot', () => { | |
| expect(1).toMatchInlineSnapshot('1') | |
| }) |
- Run test
$ pnpm -C test/browser test-fixtures run -u test/snapshot.test.ts -t inline
...
✓ test/snapshot.test.ts (3)
✓ inline snapshot
↓ snapshot [skipped]
↓ file snapshot [skipped]
Snapshots 1 updated
Test Files 1 passed (1)
Tests 1 passed | 2 skipped (3)
Start at 17:47:52
Duration 1.22s (transform 0ms, setup 0ms, collect 13ms, tests 7ms, environment 0ms, prepare 0ms)- See
test/snapshot.test.tsstill hasexpect(2).toMatchInlineSnapshot('1')
System Info
System:
OS: Linux 6.7 Arch Linux
CPU: (12) x64 AMD Ryzen 5 5625U with Radeon Graphics
Memory: 4.23 GB / 14.98 GB
Container: Yes
Shell: 5.2.26 - /bin/bash
Binaries:
Node: 18.19.0 - ~/.volta/tools/image/node/18.19.0/bin/node
Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
npm: 10.2.3 - ~/.volta/tools/image/node/18.19.0/bin/npm
pnpm: 8.10.3 - ~/.volta/tools/image/node/18.19.0/bin/pnpm
bun: 1.0.26 - ~/.volta/bin/bun
Browsers:
Chromium: 122.0.6261.57
npmPackages:
@vitest/browser: workspace:* => 1.3.1
@vitest/coverage-istanbul: workspace:* => 1.3.1
@vitest/coverage-v8: workspace:* => 1.3.1
@vitest/ui: workspace:* => 1.3.1
vite: ^5.0.12 => 5.0.12
vitest: workspace:* => 1.3.1Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feat: browserIssues and PRs related to the browser runnerIssues and PRs related to the browser runnerp3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Type
Projects
Status
Has plan