question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jest addon not hot reloading test results

See original GitHub issue

Describe 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:closed
  • Created 5 years ago
  • Comments:26 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
shilmancommented, Jul 17, 2019

@CodeByAlex Any chance you can look at this as part of your work on the Jest addon?

2reactions
sergej-scommented, Jul 1, 2019

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 test-addon ends up with old jest-test-results.json albeit is reloaded successfully. After jest completed testing hmr tries to do reloading again for the changed jest-test-results.json file and for components that depend on it. Nothing seems to depend on jest-test-results.json if test-addon is configured in config.js so test tab stays unreloaded. The only way I found to solve the issue is that jest-test-results.json should be explicitly imported in test files as a dependency: image If there is a better way plz msg here 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found