Skip to content

Commit

Permalink
Merge pull request #388 from pixiv/feat/storyshots
Browse files Browse the repository at this point in the history
add storyshots
  • Loading branch information
naporin0624 authored Oct 30, 2023
2 parents e250c83 + e6dba9f commit 399bf17
Show file tree
Hide file tree
Showing 42 changed files with 23,001 additions and 109 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ jobs:
cache: yarn

- run: yarn install --immutable --inline-builds
- run: yarn test
- run: |
yarn test
yarn storyshots
env:
CI: 'true'
Expand Down
3 changes: 3 additions & 0 deletions __mocks__/file.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const file = 'test-file-stub'

export default file
1 change: 1 addition & 0 deletions __mocks__/mdx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default ''
1 change: 1 addition & 0 deletions __mocks__/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {}
23 changes: 23 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
import type { ReactNode } from 'react'

export {}

globalThis.ResizeObserver = jest.fn().mockImplementation(() => ({
observe: jest.fn(),
unobserve: jest.fn(),
disconnect: jest.fn(),
}))

window.matchMedia = jest.fn().mockImplementation((query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(),
removeListener: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
}))

jest.mock('@react-aria/utils', () => ({
...jest.requireActual('@react-aria/utils'),
useId: () => 'test-id',
}))

jest.mock('@react-aria/overlays', () => ({
...jest.requireActual('@react-aria/overlays'),
Overlay: jest.fn(({ children }: { children: ReactNode }) => children),
}))
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"build": "yarn workspaces foreach -vpt -j unlimited run build",
"clean": "yarn workspaces foreach -vp run clean",
"test": "jest",
"storyshots": "jest -c storyshots.config.mjs",
"test:strict": "USE_STRICT=1 jest",
"typecheck": "yarn workspaces foreach -vp run typecheck",
"typecheck:config": "tsc",
Expand All @@ -41,10 +42,12 @@
"@commitlint/config-lerna-scopes": "^16.0.0",
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@storybook/addon-a11y": "^7.4.1",
"@storybook/addon-docs": "^7.5.1",
"@storybook/addon-essentials": "^7.4.1",
"@storybook/addon-interactions": "^7.4.1",
"@storybook/addon-links": "^7.4.1",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/addon-storyshots": "7.4.1",
"@storybook/addon-storysource": "^7.4.1",
"@storybook/addon-styling": "^1.3.7",
"@storybook/addon-styling-webpack": "^0.0.5",
Expand Down Expand Up @@ -84,6 +87,7 @@
"prettier": "^2.8.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "17.0.2",
"storybook": "^7.4.1",
"storybook-dark-mode": "^3.0.1",
"styled-components": "^5.3.3",
Expand All @@ -102,5 +106,8 @@
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
}
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"resolutions": {
"react-test-renderer": "17.0.2"
}
}
Loading

0 comments on commit 399bf17

Please sign in to comment.