Skip to content

Commit

Permalink
bring PW CT back
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed May 28, 2024
1 parent caa0b03 commit 4394a23
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 68 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ junit
.env.test.local
.env.production.local
.cache
.vite-inspect

npm-debug.log*
yarn-debug.log*
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"serve": "vite preview",
"test": "yarn vitest:node",
"test-ct": "playwright test",
"inspect": "serve .vite-inspect",
"vitest:storyshots": "yarn vitest:node storybook.test.ts",
"vitest:plugin": "PLUGIN_ONLY=true yarn vitest:node",
"vitest:storyshots:browser": "yarn vitest:browser storybook.test.ts",
Expand Down Expand Up @@ -83,6 +84,7 @@
"@chromatic-com/storybook": "^1.2.18",
"@hipster/experimental-vitest-plugin-sb": "1.0.1-canary.11.15e4878.0",
"@ladle/react": "^4.0.3",
"@playwright/experimental-ct-react": "^1.44.1",
"@storybook/addon-a11y": "^8.1.2",
"@storybook/addon-coverage": "^1.0.1",
"@storybook/addon-designs": "^8.0.0",
Expand All @@ -94,7 +96,7 @@
"@storybook/react": "^8.1.2",
"@storybook/react-vite": "^8.1.2",
"@storybook/test": "^8.1.2",
"@storybook/test-runner": "0.19.0--canary.467.e63ce96.0",
"@storybook/test-runner": "0.19.0--canary.467.0283f4f.0",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^15.0.5",
"@testing-library/user-event": "^14.5.2",
Expand Down Expand Up @@ -143,6 +145,7 @@
"react-test-renderer": "^18.3.1",
"storybook": "^8.1.2",
"vite": "^4.0.0",
"vite-plugin-inspect": "^0.8.4",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0",
Expand Down
11 changes: 9 additions & 2 deletions test.browser.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { defineConfig, defaultInclude, defaultExclude } from 'vitest/config'
import { mergeConfig } from 'vite'
import { storybookTest } from '@hipster/experimental-vitest-plugin-sb'
// import Inspect from 'vite-plugin-inspect'

import viteConfig from './vite.config'

Expand All @@ -11,7 +12,11 @@ let plugins: any[] = []
if (process.env.PLUGIN_ONLY) {
include = ['src/**/*.stories.tsx']
exclude = [...defaultExclude, 'storybook.test.ts']
plugins = [storybookTest()]
plugins = [
storybookTest(),
// in case we want to debug the Storybook plugin transformation
// Inspect({ build: true, outputDir: '.vite-inspect' })
]
} else {
include = defaultInclude
exclude = [...defaultExclude, 'src/**/*.stories.tsx']
Expand All @@ -30,19 +35,21 @@ export default mergeConfig(
exclude,
globals: true,
clearMocks: true,
isolate: true,
server: {
deps: {
inline: ['vitest-canvas-mock'],
},
},
browser: {
isolate: true,
enabled: true,
name: process.env.WDIO ? 'chrome' : 'chromium',
provider: process.env.WDIO ? 'webdriverio' : 'playwright',
},
setupFiles: './src/setupTests.browser.ts',
coverage: {
provider: 'istanbul',
provider: 'v8',
reporter: ['text', 'html'],
exclude: ['node_modules/', 'src/setupTests.browser.ts'],
},
Expand Down
9 changes: 7 additions & 2 deletions test.node.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { defineConfig, defaultInclude, defaultExclude } from 'vitest/config'
import { mergeConfig } from 'vite'
import { storybookTest } from '@hipster/experimental-vitest-plugin-sb'
// import Inspect from 'vite-plugin-inspect'

import viteConfig from './vite.config'

Expand All @@ -11,7 +12,11 @@ let plugins: any[] = []
if (process.env.PLUGIN_ONLY) {
include = ['src/**/*.stories.tsx']
exclude = [...defaultExclude, 'storybook.test.ts']
plugins = [storybookTest()]
plugins = [
storybookTest(),
// in case we want to debug the Storybook plugin transformation
// Inspect({ build: true, outputDir: '.vite-inspect' })
]
} else {
include = defaultInclude
exclude = [...defaultExclude, 'src/**/*.stories.tsx']
Expand All @@ -30,6 +35,7 @@ export default mergeConfig(
test: {
include,
exclude,
isolate: true,
globals: true,
clearMocks: true,
setupFiles: './src/setupTests.node.ts',
Expand All @@ -40,7 +46,6 @@ export default mergeConfig(
},
environment: 'happy-dom',
coverage: {
provider: 'istanbul',
reporter: ['text', 'html'],
exclude: ['node_modules/', 'src/setupTests.node.ts'],
},
Expand Down
Loading

0 comments on commit 4394a23

Please sign in to comment.