diff --git a/code/addons/docs/src/preset.ts b/code/addons/docs/src/preset.ts index 6e784adec8cf..98413dda423c 100644 --- a/code/addons/docs/src/preset.ts +++ b/code/addons/docs/src/preset.ts @@ -105,7 +105,7 @@ async function webpack( module: { ...module, rules: [ - ...module.rules, + ...(module.rules ?? []), { test: /(stories|story)\.mdx$/, use: [ diff --git a/code/lib/telemetry/src/get-framework-info.test.ts b/code/lib/telemetry/src/get-framework-info.test.ts index 97a0ffe15c91..4120aaf92879 100644 --- a/code/lib/telemetry/src/get-framework-info.test.ts +++ b/code/lib/telemetry/src/get-framework-info.test.ts @@ -1,4 +1,5 @@ import type { StorybookConfig } from '@storybook/types'; +import path from 'path'; import { getFrameworkInfo } from './get-framework-info'; import { getActualPackageJson } from './package-json'; @@ -25,7 +26,7 @@ describe('getFrameworkInfo', () => { }); it('should resolve the framework package json correctly and strip project paths in the metadata', async () => { - const packageName = '/path/to/project/@storybook/react'; + const packageName = `${process.cwd()}/@storybook/react`.split('/').join(path.sep); const framework = { name: packageName }; const frameworkPackageJson = { name: packageName, @@ -35,8 +36,6 @@ describe('getFrameworkInfo', () => { }, }; - jest.spyOn(process, 'cwd').mockReturnValue('/path/to/project'); - (getActualPackageJson as jest.Mock).mockResolvedValueOnce(frameworkPackageJson); const result = await getFrameworkInfo({ framework } as StorybookConfig); @@ -45,7 +44,7 @@ describe('getFrameworkInfo', () => { expect(result).toEqual({ framework: { - name: '$SNIP/@storybook/react', + name: '$SNIP/@storybook/react'.split('/').join(path.sep), options: undefined, }, builder: '@storybook/builder-vite',