Open MathiasWP opened 10 months ago
I think similar to https://github.com/oven-sh/bun/issues/198. Had the same problems with testing-library/react-hooks
& testing-library/react
.
This might help you out: https://bun.sh/docs/test/dom.
Following the guide you mention, to me it appears the bunfig.toml file is not taken into account or the happydom.ts
is not preloaded properly. It only works when I put the content of happydom.ts
at the top of my test file. Are the docs up to date?
This might help you out: https://bun.sh/docs/test/dom.
Thanks! This resolved my issue
Following the guide you mention, to me it appears the bunfig.toml file is not taken into account or the
happydom.ts
is not preloaded properly. It only works when I put the content ofhappydom.ts
at the top of my test file. Are the docs up to date?
I don't know about Jan 12, but it is working now. I moved happydom.ts to tests folder and configured toml like this 'preload = "./tests/preloadDom.js"' but it did work from the root also.
I am still facing the same issue. I am try to setup react app using bun and when run test it's throw error.
Probably you need to add happy-dom: https://github.com/oven-sh/bun/issues/198#issuecomment-1555565193
bun test v1.1.15 (b23ba1fe)
tests/Home.test.tsx:
0 pass 1 fail 1 error Ran 1 tests across 1 files. [191.00ms]
yarn test yarn run v1.22.22 $ jest PASS tests/Home.test.tsx Page ✓ renders a heading (60 ms)
Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: 0.701 s, estimated 1 s Ran all test suites. Done in 2.50s. ![Uploading Screenshot from 2024-07-11 15-26-29.png…]()
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
What platform is your computer?
Darwin 22.6.0 arm64 arm
What steps can reproduce the bug?
I've created a minimal repro here: https://github.com/MathiasWP/bun-testing-library-bug-repro/blob/main/test/Component.test.ts
Copied over code of test that should pass (but crashes):
What is the expected behavior?
The test should pass
What do you see instead?
Additional information
I really hope this can be fixed,
bun test
is amazing. First time i've tried a testing library for JS/TS that is actually blazingly fast. It decreases our test time from ~10 minutes to seconds.