When storybook is running, I encounter these errors, for all my test commands.
● Test suite failed to run
Cannot find module '/Users/macOS/Documents/Projects/design-system/node_modules/.vite/@testing-library_jest-dom.js' from 'src/jest-setup.ts'
at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:311:11)
After I shut down storybook, i ran it again.
npm run test
On first run, I got the same errors as above.
npm run test:watch or npm run test:coverage
Cannot find module '/Users/macOS/Documents/Projects/design-system/node_modules/.vite/@storybook_testing-vue3.js' from 'src/components/atoms/base-button/base-button.spec.ts'
at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:311:11)
npm run test:clear
I got these errors, no matter how many times i ran this command.
● Base Button › Should not be clickable when loading
TypeError: userEvent.tab is not a function
What works?
After running npm run test:clear once, I can run the test npm run test:watch or npm run test:coverage but npm run test return this same error above.
Cannot find module '/Users/macOS/Documents/Projects/design-system/node_modules/.vite/@storybook_testing-vue3.js' from 'src/components/atoms/base-button/base-button.spec.ts'
I wanted to use vite-jest as my test running with @testing-library/user-event and the test runner run into an error, sometimes, on certain mode.
A little background, my setup is running Vue 3 using Vite as well as Storybook with Vite builder.
Configurations
jest.config.ts
tsconfig.json
jest-setup.ts
package.json
What doesn't works?
When storybook is running, I encounter these errors, for all my test commands.
After I shut down storybook, i ran it again.
npm run test
On first run, I got the same errors as above.
npm run test:watch
ornpm run test:coverage
npm run test:clear
I got these errors, no matter how many times i ran this command.
What works?
After running
npm run test:clear
once, I can run the testnpm run test:watch
ornpm run test:coverage
butnpm run test
return this same error above.