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

Storyshots afterAll is not defined error #7959

Closed
himanshu-dixit opened this issue Sep 2, 2019 · 15 comments
Closed

Storyshots afterAll is not defined error #7959

himanshu-dixit opened this issue Sep 2, 2019 · 15 comments

Comments

@himanshu-dixit
Copy link

Describe the bug

ReferenceError: afterAll is not defined
    at Object.<anonymous> (/Users/himanshu/Desktop/headout/aer/node_modules/jest-specific-snapshot/dist/index.js:28:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/himanshu/Desktop/headout/aer/node_modules/@storybook/addon-storyshots/dist/test-bodies.js:9:1)

To Reproduce
Boilerplate of code.

https://github.com/himanshu-dixit/storybook-mock-setup

Expected behavior
Should run the test

Screenshots
If applicable, add screenshots to help explain your problem.

Code snippets
If applicable, add code samples to help explain your problem.

System:
Please paste the results of npx -p @storybook/cli@next sb info here.

Additional context
Add any other context about the problem here.

@stale
Copy link

stale bot commented Sep 23, 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 23, 2019
@dlombardi
Copy link

This is still happening:


    ReferenceError: afterAll is not defined

      1 | import registerRequireContextHook from 'babel-plugin-require-context-hook/register';
    > 2 | import initStoryshots from '@storybook/addon-storyshots';
        |                                               ^
      3 |
      4 | registerRequireContextHook();
      5 | initStoryshots();

      at Object.<anonymous> (node_modules/jest-specific-snapshot/dist/index.js:28:1)
      at Object.<anonymous> (node_modules/@storybook/addon-storyshots/dist/test-bodies.js:9:1)
      at Object.<anonymous> (node_modules/@storybook/addon-storyshots/dist/api/ensureOptionsDefaults.js:10:19)
      at Object.<anonymous> (node_modules/@storybook/addon-storyshots/dist/api/index.js:12:53)
      at Object.<anonymous> (node_modules/@storybook/addon-storyshots/dist/index.js:52:35)
      at Object.<anonymous> (storybook/test/jest.setup.js:2:47)

@stale stale bot removed the inactive label Oct 8, 2019
@stale
Copy link

stale bot commented Oct 29, 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 Oct 29, 2019
@stale
Copy link

stale bot commented Nov 29, 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 stale bot closed this as completed Nov 29, 2019
@RyanPayso13
Copy link

I am experiencing this. Anyone have any ideas?

@RyanPayso13
Copy link

Is there any idea as to why this might be happening as it is blocking my progress with chromatic!

@crunchyfrog42
Copy link

Today, I suddenly got the same error when trying to start storybook. Deleting node_modules/.cache/storybook solved the issue for me. I'm still seeing the error message, but apart from this, everything seems to be working.

@vdpdev
Copy link

vdpdev commented Dec 23, 2020

@crunchyfrog42 this didn't help for me. Still watching for this issue be solved.

@cherylcarpenter
Copy link

This issue is preventing me from using storyshot. I don't understand why things get closed.
Environment Info:

System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Binaries:
Node: 12.13.1 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.12.1 - /usr/local/bin/npm
Browsers:
Chrome: 88.0.4324.96
Safari: 14.0.1
npmPackages:
@storybook/addon-actions: ^6.1.11 => 6.1.14
@storybook/addon-essentials: ^6.1.11 => 6.1.14
@storybook/addon-knobs: ^6.1.15 => 6.1.15
@storybook/addon-links: ^6.1.11 => 6.1.14
@storybook/addon-notes: ^5.3.21 => 5.3.21
@storybook/addon-storyshots: ^6.1.15 => 6.1.15
@storybook/addon-storysource: ^6.1.15 => 6.1.15
@storybook/addons: ^6.1.14 => 6.1.14
@storybook/preset-scss: ^1.0.3 => 1.0.3
@storybook/theming: ^6.1.14 => 6.1.14
@storybook/vue: ^6.1.11 => 6.1.14

@phated
Copy link
Contributor

phated commented Feb 4, 2021

I just ran into this and it took me a little bit to figure it out. Essentially, you can't add @storybook/addon-storyshots to your list of addons in .storybook/main.js because it doesn't have Jest globals available. Instead, you just create the test files and then run Jest and it generates the storyshot files.

I'm not exactly sure why this is called an "addon" if it can't be added to that addon list.

@unknownterritory
Copy link

Thank you, @phated ! This was a mostly innocuous but nevertheless irritating warning. I am quite happy to see it gone.

@shilman
Copy link
Member

shilman commented Feb 11, 2021

Boo-yah!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-alpha.25 containing PR #13842 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

@shilman
Copy link
Member

shilman commented Feb 14, 2021

Huzzah!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.18 containing PR #13842 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade

@Ravindersingh1526
Copy link

Ravindersingh1526 commented Apr 1, 2021

Don't add addon @storybook/addon-storyshots in main.js file then working fine

@Jarzka
Copy link

Jarzka commented Aug 10, 2023

Also got the same error with vitest. It seems that there is no support for it (yet): #17578

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