-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Open
Description
Describe the bug
While testing, I noticed that if a Vitest config file looks like this, Storybook initializes correctly with testing features:
import { mergeConfig, defineConfig, coverageConfigDefaults } from 'vitest/config'
import viteConfig from './vite.config'
export default mergeConfig(
viteConfig,
defineConfig({
test: {
name: 'node',
environment: 'happy-dom',
},
})
)But when it does not use defineConfig (or a function call) and rather uses just an object:
import { mergeConfig, coverageConfigDefaults } from 'vitest/config'
import viteConfig from './vite.config'
export default mergeConfig(
viteConfig,
{
test: {
name: 'node',
environment: 'happy-dom',
},
}
)Then the file will be deemed with a not supported format.
The bug occurs in this specific method:
https://github.com/storybookjs/storybook/blob/next/code/core/src/cli/AddonVitestService.ts#L370
Which is called as part of this method:
https://github.com/storybookjs/storybook/blob/next/code/core/src/cli/AddonVitestService.ts#L331
I tried forcing the function to just return true and the latter logic which modifies the file works as intended, so it's just a matter of fixing the detection.
dosubotcoderabbitai