Skip to content

[Feature Request]: Nextjs next/jest support #22894

@kodai3

Description

@kodai3

Is your feature request related to a problem? Please describe

I'm having trouble setup next/jest with storybook Import stories.

With jest-babel works as expected, migrating to next/jest it fails to import the config file.

Cannot find module '.storybook/preview' from 'setupFiles.js'

However, Jest was able to find:
	'.storybook/preview.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json', 'node'].

import * as globalStorybookConfig from './.storybook/preview';
When I remove this line it works, but cannot leverage the global config we need from the storybook.

here is the repro repo based on the with-jest and with-jest-babel examples.

Describe the solution you'd like

I want at least some documentation how to setup.

Describe alternatives you've considered

No response

Are you able to assist to bring the feature to reality?

yes, I can

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions