Skip to content

Commit

Permalink
Storybook: Perform cleanup in the Storybook setup (#27786)
Browse files Browse the repository at this point in the history
* Storybook: Perform cleanup in the Storybook setup

* Update the lock file after removing no longer used Babel plugin
  • Loading branch information
gziolo authored Dec 18, 2020
1 parent 995a112 commit 29bb0e6
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 30 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ node_modules
packages/block-serialization-spec-parser/parser.js
packages/e2e-tests/plugins
packages/react-native-editor/bundle
playground/dist
vendor
wordpress
!.*.js
2 changes: 1 addition & 1 deletion .github/workflows/storybook-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./playground/dist
publish_dir: ./storybook/build
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ yarn.lock
/wordpress
/artifacts

playground/dist
.cache
*.tsbuildinfo

Expand Down
3 changes: 1 addition & 2 deletions docs/contributors/testing-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,8 @@ It's tempting to snapshot deep renders, but that makes for huge snapshots. Addit
Sometimes we need to mock refs for some stories which use them. Check the following documents to learn more:

- Why we need to use [Mocking Refs for Snapshot Testing](https://reactjs.org/blog/2016/11/16/react-v15.4.0.html#mocking-refs-for-snapshot-testing) with React.
- [Using createNodeMock to mock refs](https://github.com/storybookjs/storybook/tree/master/addons/storyshots/storyshots-core#using-createnodemock-to-mock-refs) with StoryShots.

In that case, you might see test failures and `TypeError` reported by Jest in the lines which try to access a property from `ref.current`. If this happens, search for `initStoryshots` method call, which contains all necessary configurations to adjust.
In that case, you might see test failures and `TypeError` reported by Jest in the lines which try to access a property from `ref.current`.

### Debugging Jest unit tests

Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@
"babel-plugin-inline-json-import": "0.3.2",
"babel-plugin-react-native-classname-to-style": "1.2.2",
"babel-plugin-react-native-platform-specific-extensions": "1.1.1",
"babel-plugin-require-context-hook": "1.0.0",
"benchmark": "2.1.4",
"browserslist": "4.15.0",
"chalk": "4.0.0",
Expand Down Expand Up @@ -262,13 +261,9 @@
"test-unit:native": "cd test/native/ && cross-env NODE_ENV=test jest --config ./jest.config.js",
"test-unit:native:debug": "cd test/native/ && node --inspect ../../node_modules/.bin/jest --runInBand --config ./jest.config.js",
"prestorybook:build": "npm run build:packages",
"storybook:build": "build-storybook -c ./storybook -o ./playground/dist",
"storybook:build": "build-storybook -c ./storybook -o ./storybook/build",
"prestorybook:dev": "npm run build:packages",
"storybook:dev": "concurrently \"npm run dev:packages\" \"start-storybook -c ./storybook -p 50240\"",
"design-system:build": "echo \"Please use storybook:build instead.\"",
"design-system:dev": "echo \"Please use storybook:dev instead.\"",
"playground:build": "npm run storybook:build",
"playground:dev": "echo \"Please use storybook:dev instead.\"",
"env": "wp-scripts env",
"wp-env": "wp-env"
},
Expand Down
7 changes: 1 addition & 6 deletions storybook/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,5 @@
"plugins": [
"babel-plugin-emotion",
"babel-plugin-inline-json-import"
],
"env": {
"test": {
"plugins": [ "babel-plugin-require-context-hook" ]
}
}
]
}
6 changes: 0 additions & 6 deletions test/unit/config/register-context.js

This file was deleted.

1 change: 0 additions & 1 deletion test/unit/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module.exports = {
setupFiles: [
'<rootDir>/test/unit/config/global-mocks.js',
'<rootDir>/test/unit/config/gutenberg-phase.js',
'<rootDir>/test/unit/config/register-context.js',
],
testURL: 'http://localhost',
testPathIgnorePatterns: [
Expand Down

0 comments on commit 29bb0e6

Please sign in to comment.