You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I don't choose jsdom as a default for jest, the generated tests don't pass. I get
❯❯❯❯ npm run test ~/D/w/s/f/s/e/sveltekit master
> [email protected] test
> NODE_OPTIONS=--experimental-vm-modules jest src --config jest.config.json
(node:87367) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
FAIL src/routes/index-dom.spec.ts
Index
once the component has been rendered
✕ should show the proper heading (2 ms)
● Index › once the component has been rendered › should show the proper heading
The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
Consider using the "jsdom" test environment.
ReferenceError: document is not defined
19 |
20 | beforeEach(() => {
> 21 | renderedComponent = render(Index);
| ^
22 | });
23 |
24 | describe('once the component has been rendered', () => {
at render (node_modules/@testing-library/svelte/dist/pure.js:53:28)
at Object.<anonymous> (src/routes/index-dom.spec.ts:21:25)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 3.917 s, estimated 5 s
Ran all test suites matching /src/i.
This is solved by moving the comment:
/**
* @jest-environment jsdom
*/
to the very top of the files.
The text was updated successfully, but these errors were encountered:
If I don't choose
jsdom
as a default for jest, the generated tests don't pass. I getThis is solved by moving the comment:
to the very top of the files.
The text was updated successfully, but these errors were encountered: