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

require.context in nested modules #3406

Closed
goodmind opened this issue Apr 12, 2018 · 4 comments
Closed

require.context in nested modules #3406

goodmind opened this issue Apr 12, 2018 · 4 comments

Comments

@goodmind
Copy link

goodmind commented Apr 12, 2018

Bug or support request summary

require.context only polyfilled in top config, but not in other required file in @storybook/addon-storyshots

@Hypnosphi
Copy link
Member

Probably related: #2894

@stale
Copy link

stale bot commented May 7, 2018

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 May 7, 2018
@quinn
Copy link

quinn commented Jun 1, 2018

I think I am having this same issue:

$ node_modules/.bin/jest
 => Loading custom .babelrc
 FAIL  stories/test.js
  ● Test suite failed to run

    TypeError: require.context is not a function

      1 | import { configure } from '@storybook/react';
      2 |
    > 3 | const context = require.context('../components', true, /stories.js$/)
        |                         ^
      4 |
      5 | configure(() => context.keys().forEach(context), module)
      6 |

      at Object.<anonymous> (stories/index.js:3:25)
      at newRequire (node_modules/@storybook/addon-storyshots/dist/require_context.js:83:14)
      at loadStories (evalmachine.<anonymous>:6:2)
      at ConfigApi.configure (node_modules/@storybook/core/dist/client/preview/config_api.js:63:9)
      at evalmachine.<anonymous>:9:22
      at runWithRequireContext (node_modules/@storybook/addon-storyshots/dist/require_context.js:113:3)
      at Object.load (node_modules/@storybook/addon-storyshots/dist/react/loader.js:33:33)
      at loadFramework (node_modules/@storybook/addon-storyshots/dist/frameworkLoader.js:36:17)
      at testStorySnapshots (node_modules/@storybook/addon-storyshots/dist/index.js:72:54)
      at Object.<anonymous> (stories/test.js:3:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        2.854s
Ran all test suites.

@Hypnosphi
Copy link
Member

Released as 4.0.0-alpha.10

aretecode added a commit to aretecode/konsilos that referenced this issue Sep 22, 2019
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

4 participants