Jest addon not hot reloading test results
See original GitHub issueDescribe the bug Jest test results are not hot reloaded in the ‘Tests’ addon tab. Manual refreshing required to see updated test results.
To Reproduce Steps to reproduce the behavior:
- Create CRA app
- Setup storybook and jest addon as described in respective projects
- Setup command in
package.json
"test:generate-output": "react-scripts test --json --outputFile=.storybook/jest-test-results.json --silent --verbose=false || true",
"prestorybook:dev": "clear && echo \"DOING FIRST TEST RUN\" && CI=true yarn run test:generate-output",
"storybook": "start-storybook -p 9009 -s public",
"storybook:dev": "clear && concurrently -n storybook,jest -k \"yarn run storybook --quiet\" \"yarn run test:generate-output\""
- Create test
yarn storybook:dev
Expected behavior
Run tests and have hot reloading in Tests tab, as displayed in the animated gif in the jest-addon
README.
System:
- OS: Ubuntu
- Browser: Safari
- Framework: React
- Addons: addon-jest
- Version: 4.1.6
Issue Analytics
- State:
- Created 5 years ago
- Comments:26 (7 by maintainers)
Top Results From Across the Web
Jest addon not hot reloading test results · Issue #5225 - GitHub
Describe the bug Jest test results are not hot reloaded in the 'Tests' addon tab. Manual refreshing required to see updated test results....
Read more >Storybook jest addon does not show results - Stack Overflow
I have faced a similar issue as yours, I have found an issue on storybook's github which solved the problem. Basically, on your...
Read more >A complete guide to full-stack live reload - LogRocket Blog
Implementing live reload with Node.js and nodemon; Live reload with nodemon and TypeScript; Automated JavaScript testing with Jest in watch mode ...
Read more >Jest Addon | Storybook: Frontend workshop for UI development
Storybook addon for inspecting Jest unit test results. ... This change will then be HMR (hot module reloaded) using webpack and displayed by...
Read more >Vue.js and Vuetify unit testing with Jest - IOBIO
It also includes vue-test-utils which is a great library that makes testing a lot easier in vue. It also provides the hot reloading...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@CodeByAlex Any chance you can look at this as part of your work on the Jest addon?
In case someone stumble upon this issue: hmr does work but not in the right order. When the story/test file is being changed then hmr hits updating of storybook immediately without waiting for jest to complete testing. So
If there is a better way plz msg here 😃
test-addon
ends up with oldjest-test-results.json
albeit is reloaded successfully. After jest completed testing hmr tries to do reloading again for the changedjest-test-results.json
file and for components that depend on it. Nothing seems to depend onjest-test-results.json
iftest-addon
is configured in config.js so test tab stays unreloaded. The only way I found to solve the issue is thatjest-test-results.json
should be explicitly imported in test files as a dependency: