11import path from 'node:path' ;
22import { fileURLToPath } from 'node:url' ;
33import { storybookTest } from '@storybook/addon-vitest/vitest-plugin' ;
4- import { defineConfig , mergeConfig } from 'vitest/config' ;
4+ import { playwright } from '@vitest/browser-playwright' ;
5+ import { mergeConfig } from 'vitest/config' ;
56
67import viteConfig from '../../vite.config' ;
78
@@ -10,41 +11,38 @@ const dirname =
1011 ? __dirname
1112 : path . dirname ( fileURLToPath ( import . meta. url ) ) ;
1213
13- export default mergeConfig (
14- viteConfig ,
15- defineConfig ( {
16- plugins : [
17- storybookTest ( {
18- configDir : path . join ( dirname , '.storybook' ) ,
19- storybookScript : 'pnpm dev --ci' ,
20- } ) ,
21- ] ,
22- test : {
23- exclude : [ './../../packages/**/*.chromatic.tsx' , './../../**/*.mdx' ] ,
24- watch : false ,
25- browser : {
26- enabled : true ,
27- instances : [ { browser : 'chromium' } ] ,
28- provider : 'playwright' ,
29- headless : true ,
30- } ,
31- setupFiles : [ './.storybook/vitest.setup.ts' ] ,
32- reporters : [
33- 'default' ,
34- [
35- 'junit' ,
36- {
37- outputFile : 'test-report.xml' ,
38- suiteName : 'Storybook tests' ,
39- addFileAttribute : true ,
40- classnameTemplate : ( vars : {
41- filename : string ;
42- filepath : string ;
43- } ) : string =>
44- vars . filename . split ( '../../packages/react/' ) [ 1 ] ?? vars . filename ,
45- } ,
46- ] ,
47- ] ,
14+ export default mergeConfig ( viteConfig , {
15+ plugins : [
16+ storybookTest ( {
17+ configDir : path . join ( dirname , '.storybook' ) ,
18+ storybookScript : 'pnpm dev --ci' ,
19+ } ) ,
20+ ] ,
21+ test : {
22+ exclude : [ './../../packages/**/*.chromatic.tsx' , './../../**/*.mdx' ] ,
23+ watch : false ,
24+ browser : {
25+ enabled : true ,
26+ instances : [ { browser : 'chromium' } ] ,
27+ provider : playwright ( ) ,
28+ headless : true ,
4829 } ,
49- } ) ,
50- ) ;
30+ setupFiles : [ './.storybook/vitest.setup.ts' ] ,
31+ reporters : [
32+ 'default' ,
33+ [
34+ 'junit' ,
35+ {
36+ outputFile : 'test-report.xml' ,
37+ suiteName : 'Storybook tests' ,
38+ addFileAttribute : true ,
39+ classnameTemplate : ( vars : {
40+ filename : string ;
41+ filepath : string ;
42+ } ) : string =>
43+ vars . filename . split ( '../../packages/react/' ) [ 1 ] ?? vars . filename ,
44+ } ,
45+ ] ,
46+ ] ,
47+ } ,
48+ } ) ;
0 commit comments