storybook: StoryShots ReferenceError: unknown base.cacheDirectory
I get Unknown option: base.cacheDirectory when trying to run StoryShots through Jest on vanilla project from create-react-app with only StoryBook added.
StoryBook works ok with create-react-app.
There was also an error regarding react-test-renderer because installing StoryShots doesn’t install it, but that can be fixed with npm install.
PASS src\App.test.js
FAIL src\storyshots.test.js
● Test suite failed to run
ReferenceError: [BABEL] C:\test\.storybook\config.js: Unknown option: base.cacheDirectory. Check out http://b
abeljs.io/docs/usage/options/ for more information about options.
A common cause of this error is the presence of a configuration options object without the corresponding preset
name. Example:
Invalid:
`{ presets: [{option: value}] }`
Valid:
`{ presets: [['presetName', {option: value}]] }`
For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets
-options.
at Logger.error (node_modules/babel-core/lib/transformation/file/logger.js:41:11)
at OptionManager.mergeOptions (node_modules/babel-core/lib/transformation/file/options/option-manager.js:226:
20)
at OptionManager.init (node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at Object.transformFileSync (node_modules/babel-core/lib/api/node.js:152:10)
at testStorySnapshots (node_modules/@storybook/addon-storyshots/dist/index.js:88:25)
at Object.<anonymous> (src/storyshots.test.js:3:31)
at <anonymous>
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 3.074s
Ran all test suites related to changed files.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 6
- Comments: 17 (9 by maintainers)
Fixed in 3.1.6!
I worked around this issue by commenting out line 20 of
./node_modules/@storybook/react/dist/server/config/babel.jswhere thecacheDirectoryoption is:@tmeasday It helps with the first error but then I get same error as above:
Another workaround is sticking to
"@storybook/addon-storyshots": "3.0.0", it seems commit https://github.com/storybooks/storybook/commit/da961dc5081a6ce468af01993baf73abc1a65881 introduced the issue.