Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to render with error "(0 , import_upath.normalize) is not a function" #458

Open
squidjam opened this issue May 23, 2023 · 0 comments

Comments

@squidjam
Copy link

squidjam commented May 23, 2023

Using loki with the addon-jest to show test-results on the component's storybook page will produce an error.

Packages and versions:

  • storybook: 7.0.15
  • adodn-jest: 7.0.15
  • loki: 0.31.2

Reproduction:

// SampleComponent.stories.tsx

import { Meta, StoryObj } from '@storybook/react'
import results from '../../../.test-results.json'; // jest json output
import { withTests } from '@storybook/addon-jest'
import { SampleComponent } from './SampleComponent'

const meta = {
  title: 'Sample Component',
  tags: ['autodocs'],
} satisfies Meta<typeof SampleComponent>

export default meta;
type Story = StoryObj<typeof SampleComponent>

export const Sample: Story = {
  args: {},
  decorators: [withTests({results})],
}

Error message:

 FAIL  chrome.app/chrome.laptop/Stories/SampleComponent                                     
       Sample Component
       Failed to render with error "(0 , import_upath.normalize) is not a function"
 FAIL  chrome.app
Some visual tests failed to run
error Command failed with exit code 1.

Observed results:

  • Running yarn loki update without the decorator and related imports, the test passes.
  • Running the storybook with decorators and related imports, storybook works and shows the desired results for it.
  • Both at the same time will not work and produce the aforementioned error.

I would appreciate if someone could give this a look?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant