Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular Storyshots 5.0.6: Cannot read property 'get' of undefined #6490

Closed
rfreydi opened this issue Apr 11, 2019 · 22 comments
Closed

Angular Storyshots 5.0.6: Cannot read property 'get' of undefined #6490

rfreydi opened this issue Apr 11, 2019 · 22 comments

Comments

@rfreydi
Copy link

rfreydi commented Apr 11, 2019

Describe the bug
I was trying to follow the tutorial from https://www.learnstorybook.com/angular/en/simple-component/ but got a lot of trouble (the doc for jest-preset-angular is not up to date and hard to find the right way).

I'm stuck with last step, I think I configured everything up but when I run the jest test angularshots.test.ts fail. it look like it's the import 'global' which doesn't work properly from addon-storyshots/dist/api/index.js.

To Reproduce
Steps to reproduce the behavior:

  1. Clone repository at https://github.com/chromaui/learnstorybook-code/tree/angular
  2. Apply the patch from attached file (remove .txt in the extension)
  3. Run "npm i"
  4. Run "npm run jest"
  5. See error

I personally use Intellij IDEA built-in Jest runner which is more visual (screenshot come from it)

migrate_to_v5.patch.txt

Expected behavior
The test should run like for the v3 version of the repo

Screenshots
v5
image

v3
image

System:

  • OS: MacOS
  • Device: MacBook Pro (15-inch, 2018)
  • NodeJS: v11.12.0
  • Framework: Angular 7.3.8
  • Addons: storyshots
  • Version: 5.0.6
@stale
Copy link

stale bot commented May 2, 2019

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!

@markusdresch
Copy link

I got the same problem with

  • Storyshots ^5.0.11
  • OS: Windows 10
  • Node v11.12.0
  • Angular 8.0.0-rc.4
TypeError: Cannot read property 'get' of undefined

    > 1 | import initStoryshots, { multiSnapshotWithOptions } from '@storybook/addon-storyshots';
        | ^
      2 | 
      3 | initStoryshots({
      4 |     test: multiSnapshotWithOptions({}),

      at _interopRequireWildcard (node_modules/@storybook/addon-storyshots/dist/api/index.js:22:331)
      at Object.<anonymous> (node_modules/@storybook/addon-storyshots/dist/api/index.js:8:15)
      at Object.<anonymous> (node_modules/@storybook/addon-storyshots/dist/index.js:52:35)
      at Object.<anonymous> (src/storyshots.test.ts:1:1)

@stale
Copy link

stale bot commented Jun 18, 2019

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!

@stale stale bot added the inactive label Jun 18, 2019
@stale
Copy link

stale bot commented Jul 18, 2019

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale
Copy link

stale bot commented Sep 6, 2019

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!

@stale stale bot added the inactive label Sep 6, 2019
@rfreydi
Copy link
Author

rfreydi commented Sep 6, 2019

Up (to not get closed again for nothing...)

@stale stale bot removed the inactive label Sep 6, 2019
@smikolajewicz
Copy link

Hi, I have the same problem. Did you solve it?

@rfreydi
Copy link
Author

rfreydi commented Sep 12, 2019

@smikolajewicz , no it's style waiting to be resolved

@AkshayRana92
Copy link

Hi, I'm also having the same issue. Did anyone find a solution yet?

@bjufre
Copy link

bjufre commented Oct 19, 2019

@AkshayRana92 @rfreydi any luck setting it up? Getting the same exact error and can't figure out why :|

@alc-1
Copy link

alc-1 commented Nov 4, 2019

Hi, same issue on my side (Angular 8.2.12 & Storybook 5.2.5).
+1 about the fact that the tutorial would require a refresh to fit with current jest-preset-angular version.

@Hypnosphi
Copy link
Member

Hypnosphi commented Nov 9, 2019

I can reproduce in in master but not in next. Still have to find out what fixed it

UPD: seems fixed in babel with babel/babel#10161. I'll update corresponding dependencies in master

@cloakedninjas
Copy link

I seem to be getting this in 5.2.6 😟

@Hypnosphi
Copy link
Member

@shilman #8776 is yet unreleased, right?

@cloakedninjas
Copy link

Hmm, running this on Node 10 (matching our build server) this issue goes away, but on my new laptop (with Node 13.2.0) it fails 🤷‍♂

@Hypnosphi
Copy link
Member

Yes, it's an issue specific to newer Node versions

@stale
Copy link

stale bot commented Dec 17, 2019

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!

@stale stale bot added the inactive label Dec 17, 2019
@shilman shilman added the todo label Dec 18, 2019
@stale stale bot removed the inactive label Dec 18, 2019
@cloakedninjas
Copy link

This is now resolved as of 5.3.3

@shilman
Copy link
Member

shilman commented Jan 15, 2020

awesome! closing!

@shilman shilman closed this as completed Jan 15, 2020
@arungowda27
Copy link

This is now resolved as of 5.3.3

No i installed a fresh copy from create react app and then storybook with npx -p @storybook/cli sb init --type react_scripts
. But still getting the same error

@shilman
Copy link
Member

shilman commented Apr 23, 2020

@arun678 this is an angular issue?

@arungowda27
Copy link

@arun678 this is an angular issue?

No, it's react. But have encountered same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants