@@ -26,6 +26,7 @@ describe('configureMain', () => {
26
26
name : '@storybook/react-vite' ,
27
27
} ,
28
28
frameworkPackage : '@storybook/react-vite' ,
29
+ features : [ ] ,
29
30
} ) ;
30
31
31
32
const { calls } = vi . mocked ( fsp . writeFile ) . mock ;
@@ -50,7 +51,7 @@ describe('configureMain', () => {
50
51
` ) ;
51
52
} ) ;
52
53
53
- it ( 'should generate main.ts' , async ( ) => {
54
+ it ( 'should generate main.ts with docs feature ' , async ( ) => {
54
55
await configureMain ( {
55
56
language : SupportedLanguage . TYPESCRIPT ,
56
57
addons : [ ] ,
@@ -60,6 +61,41 @@ describe('configureMain', () => {
60
61
name : '@storybook/react-vite' ,
61
62
} ,
62
63
frameworkPackage : '@storybook/react-vite' ,
64
+ features : [ 'docs' ] ,
65
+ } ) ;
66
+
67
+ const { calls } = vi . mocked ( fsp . writeFile ) . mock ;
68
+ const [ mainConfigPath , mainConfigContent ] = calls [ 0 ] ;
69
+
70
+ expect ( mainConfigPath ) . toEqual ( './.storybook/main.ts' ) ;
71
+ expect ( mainConfigContent ) . toMatchInlineSnapshot ( `
72
+ "import type { StorybookConfig } from '@storybook/react-vite';
73
+
74
+ const config: StorybookConfig = {
75
+ "stories": [
76
+ "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
77
+ "../stories/**/*.mdx"
78
+ ],
79
+ "addons": [],
80
+ "framework": {
81
+ "name": "@storybook/react-vite"
82
+ }
83
+ };
84
+ export default config;"
85
+ ` ) ;
86
+ } ) ;
87
+
88
+ it ( 'should generate main.ts without docs feature' , async ( ) => {
89
+ await configureMain ( {
90
+ language : SupportedLanguage . TYPESCRIPT ,
91
+ addons : [ ] ,
92
+ prefixes : [ ] ,
93
+ storybookConfigFolder : '.storybook' ,
94
+ framework : {
95
+ name : '@storybook/react-vite' ,
96
+ } ,
97
+ frameworkPackage : '@storybook/react-vite' ,
98
+ features : [ ] ,
63
99
} ) ;
64
100
65
101
const { calls } = vi . mocked ( fsp . writeFile ) . mock ;
@@ -71,7 +107,6 @@ describe('configureMain', () => {
71
107
72
108
const config: StorybookConfig = {
73
109
"stories": [
74
- "../stories/**/*.mdx",
75
110
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"
76
111
],
77
112
"addons": [],
@@ -96,6 +131,7 @@ describe('configureMain', () => {
96
131
name : "%%path.dirname(require.resolve(path.join('@storybook/react-webpack5', 'package.json')))%%" ,
97
132
} ,
98
133
frameworkPackage : '@storybook/react-webpack5' ,
134
+ features : [ 'docs' ] ,
99
135
} ) ;
100
136
101
137
const { calls } = vi . mocked ( fsp . writeFile ) . mock ;
@@ -108,8 +144,8 @@ describe('configureMain', () => {
108
144
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
109
145
const config = {
110
146
"stories": [
111
- "../stories/**/*.mdx ",
112
- "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx) "
147
+ "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx) ",
148
+ "../stories/**/*.mdx "
113
149
],
114
150
"addons": [
115
151
path.dirname(require.resolve(path.join('@storybook/addon-essentials', 'package.json'))),
0 commit comments