Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing test for #4722 #12142

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

CMTegner
Copy link

This issue describes a problem where snapshots are not correctly being matched against existing tests, causing duplicate snapshots to be written.

What does this PR do?

This PR adds a test that provokes the issue described in #4722.

How did you verify your code works?

$ bun-debug test test/regression/issue/04722.test.ts
<debug output omitted>
28 |         stderr: "pipe",
29 |         env: bunEnv,
30 |       });
31 |       expect(await testRun.exited).toBe(0);
32 |       const snapshotFile = file(join(testDir, "__snapshots__", `${filename}.snap`));
33 |       expect(await snapshotFile.text()).toBe('// Bun Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`test 1`] = \`"\\\`${contents}\\\`"\`;\n');
                                             ^
error: expect(received).toBe(expected)

Expected: "// Bun Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`test 1`] = `\"\\`${contents}\\`\"`;\n"
Received: "// Bun Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`test 1`] = `\"\\`${contents}\\`\"`;\n\nexports[`test 1`] = `\"\\`${contents}\\`\"`;\n"

      at <redacted>/bun/test/regression/issue/04722.test.ts:33:41
      at asyncFunctionResume (:1:11)
      at promiseReactionJobWithoutPromiseUnwrapAsyncContext (:1:11)
      at promiseReactionJob (:1:11)
✗ existing snapshots are correctly parsed and matched against tests [78.82ms]

 0 pass
 1 fail
 4 expect() calls
Ran 1 tests across 1 files. [173.00ms]

This issue describes a problem where snapshots are not correctly being matched
against existing tests, causing duplicate snapshots to be written.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant