Skip to content

Commit

Permalink
chore(Storyshots): add babel plugin required to run storyshots
Browse files Browse the repository at this point in the history
  • Loading branch information
fgameiro committed Dec 26, 2018
1 parent c5c8c6b commit a225f74
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"presets": ["env", "stage-2", "react"]
"presets": ["env", "stage-2", "react"],
"env": {
"test": {
"plugins": ["babel-plugin-require-context-hook"]
}
}
}
2 changes: 2 additions & 0 deletions .storybook/jest/require.context.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import registerRequireContextHook from "babel-plugin-require-context-hook/register";
registerRequireContextHook();
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const coveragePathIgnorePatterns = [".story.js", "lib/*"];
const completeConfig = {
verbose: true,
coveragePathIgnorePatterns,
setupTestFrameworkScriptFile: "<rootDir>/jest.testFramework.js"
setupTestFrameworkScriptFile: "<rootDir>/jest.testFramework.js",
setupFiles: ["./.storybook/jest/require.context.js"]
};

const fastConfig = {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.0",
"babel-loader": "7",
"babel-plugin-require-context-hook": "^1.0.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2562,6 +2562,11 @@ babel-plugin-react-docgen@^2.0.0:
lodash "^4.17.10"
react-docgen "^3.0.0-rc.1"

babel-plugin-require-context-hook@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/babel-plugin-require-context-hook/-/babel-plugin-require-context-hook-1.0.0.tgz#3f0e7cce87c338f53639b948632fd4e73834632d"
integrity sha512-EMZD1563QUqLhzrqcThk759RhuNVX/ZJdrtGK6drwzgvnR+ARjWyXIHPbu+tUNaMGtPz/gQeAM2M6VUw2UiUeA==

"babel-plugin-styled-components@>= 1":
version "1.9.4"
resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.9.4.tgz#5f2c34d31237c6ee1e86453cc5fa488b97136669"
Expand Down

0 comments on commit a225f74

Please sign in to comment.