Developers struggle with read-only snapshot files in Bun tests
10 posts since Sep 2023, all from GitHub.
“What is the problem this feature would solve? When running a test with bun test mytest it should match the file MyTest.ts. This would improve the test and test watch experience and match how jest works. What is the feature you are proposing to solve the problem? Update the test…”
“What version of Bun is running? latest What platform is your computer? Mac osx latest M2 chip What steps can reproduce the bug? Create a simple react component and render it in a test using @testing library/react What is the expected behavior? It should print out the html into a…”
“What version of Bun is running? 1.4.6 canary.1+b15f51302 What platform is your computer? Darwin 25.5.0 arm64 What steps can reproduce the bug? With happy dom (21.0.4) installed: What is the expected behavior? "hi" in every mode. What do you see instead? With isolate (and so also…”
Developers are encountering issues where Bun tests fail when snapshot files are read-only. This behavior differs from Jest and Vitest, requiring developers to make files writable to pass tests, indicating a compatibility problem.
SOURCES (10)
“What version of Bun is running? 1.4.6 canary.1+b15f51302 What platform is your computer? Darwin 25.5.0 arm64 What steps can reproduce the bug? With happy dom (21.0.4) installed: What is the expected behavior? "hi" in every mode. What do you see instead? With isolate (and so…”
“What version of Bun is running? 1.4.3+c6da4a4d3 What platform is your computer? Darwin 27.0.0 arm64 arm (also Linux arm64 in the oven/bun:1.4.3 image, with the project mounted read only) What steps can reproduce the bug? What is the expected behavior? The test passes: the stored snapshot matches, so nothing needs writing. Jest 29.7 passes the same check with a read only snapshot file and directory, with and without ci . What do you see instead? Making the file writable again makes the test pass,”
“What version of Bun is running? 1.4.3+c6da4a4d3 What platform is your computer? Darwin 27.0.0 arm64 arm What steps can reproduce the bug? bun test ./tojson.test.js What is the expected behavior? Both snapshots serialize the value through its toJSON() method, as Jest and Vitest do: their printer, pretty format , has callToJSON: true by default. The inline snapshot passes, and the file snapshot is stored as: The same file passes with Jest 29.7 and Vitest 5.0.4 (after changing the import). What do”
“What is the problem this feature would solve? When running a test with bun test mytest it should match the file MyTest.ts. This would improve the test and test watch experience and match how jest works. What is the feature you are proposing to solve the problem? Update the test matching to match against files regardless of title case. What alternatives have you considered? Writing my own bash script using find/grep and piping the files to bun.”
What is the problem this feature would solve? This is great if we have file snapshot test like vitest has https://vitest.dev/guide/snapshot What is the feature you are proposing to solve the problem?…
What version of Bun is running? 1.1.16+bf7b327f6 What platform is your computer? Darwin 23.5.0 arm64 arm What steps can reproduce the bug? I have a project where, after doing snapshot tests, I…
“What version of Bun is running? 1.1.12+43f0913c3 What platform is your computer? Microsoft Windows NT 10.0.22631.0 x64 What steps can reproduce the bug? File 1 File 2 What is the expected behavior? With Jest, it works, every date is for the 2024 06 12, the comparison works properly. What do you see instead? With Bun, the days are delayed by one sometimes, I don't understand why. It appears that the comparison makes it output 2024 06 11 which is not even possible. image Additional information No”
“What version of Bun is running? 1.1.4+fbe2fe0c3 What platform is your computer? Darwin 23.1.0 arm64 arm What steps can reproduce the bug? The repository has full reproduction steps and an identical working example in jest. https://github.com/lucashfreitas/bun jest mock bug 1. Download the source code here: https://github.com/lucashfreitas/bun jest mock bug 2. follow the reproduction steps and run the test cases using jest and bun 3. Note that bun mock does not mock the module when it's called fr”
“What version of Bun is running? 1.0.3 What platform is your computer? Darwin arm64 arm What steps can reproduce the bug? What is actually happening? The test does not pass when Jest’s Parameterized Test runs, which the test code is written with back quote in the Bun environment. What kind of environment is it? Bun:1.0.3 TypeScript:5.2.2 Jest:^29.7.0 @types/jest: ^29.5.5 ts jest: ^29.1.1 MacOS Ventura:13.4.1 Chrome:117.0.5938.149 npm:9.6.7 yarn:1.22.19 pnpm:8.8.0 How to check this bug After creat”
“What version of Bun is running? latest What platform is your computer? Mac osx latest M2 chip What steps can reproduce the bug? Create a simple react component and render it in a test using @testing library/react What is the expected behavior? It should print out the html into a snapshot file What do you see instead? Instead it prints out a massive JSON object which in one case was over 20mb this cannot be correct Additional information Sorry did this on my mobile was unable to get specific valu”
