Storybook: Broken Storyshots with latest jest-preset-angular due to setupJest module being renamed to setup-jest on ^8.3.0

Created on 6 Sep 2020  ยท  3Comments  ยท  Source: storybookjs/storybook

Describe the bug

The jest-preset-angular library has a breaking change (and the only one that I've come across) introduced on its v8.3.0 release. They've renamed the setupJest file to setup-jest.

This loader storybook/addons/storyshots/storyshots-core/src/frameworks/angular/loader.ts is requiring setupJest.

To Reproduce
Steps to reproduce the behavior:

Use the latest storyshots with "jest-preset-angular": "^8.3.0", run jest and you'll get the following

Cannot find module 'jest-preset-angular/build/setupJest' from 'node_modules/@storybook/addon-storyshots/dist/frameworks/angular/loader.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:307:11)
      at requireActual (node_modules/@storybook/addon-storyshots/dist/frameworks/angular/loader.js:32:10)
      at Object.setupAngularJestPreset [as load] (node_modules/@storybook/addon-storyshots/dist/frameworks/angular/loader.js:38:5)
      at Object.load [as default] (node_modules/@storybook/addon-storyshots/dist/frameworks/frameworkLoader.js:26:19)
      at testStorySnapshots (node_modules/@storybook/addon-storyshots/dist/api/index.js:60:14)

Expected behavior

The tests should run normally.

Screenshots
N/A

Code snippets
N/A

System:
N/A

Additional context
N/A

Please let me know if it's alright to raise a PR for this.

PN storyshots bug dependencies

Most helpful comment

@KostasDimakis PRs very welcome!

All 3 comments

@KostasDimakis PRs very welcome!

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

I got the same error while following the official guide Learn Storybook.

โ— Test suite failed to run

Cannot find module 'jest-preset-angular/build/setup-jest' from 'node_modules/@storybook/addon-storyshots/dist/frameworks/angular/loader.js'

  at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
  at setupAngularJestPreset (node_modules/@storybook/addon-storyshots/dist/frameworks/angular/loader.js:36:14)
  at Object.load (node_modules/@storybook/addon-storyshots/dist/frameworks/angular/loader.js:43:5)
  at Object.loadFramework [as default] (node_modules/@storybook/addon-storyshots/dist/frameworks/frameworkLoader.js:26:19)
  at testStorySnapshots (node_modules/@storybook/addon-storyshots/dist/api/index.js:60:14)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

arunoda picture arunoda  ยท  3Comments

tlrobinson picture tlrobinson  ยท  3Comments

wahengchang picture wahengchang  ยท  3Comments

alexanbj picture alexanbj  ยท  3Comments

tomitrescak picture tomitrescak  ยท  3Comments