Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

[bug] @types/jest conflicting with @types/mocha #50

Closed
bryan-codaio opened this issue Nov 17, 2023 · 3 comments
Closed

[bug] @types/jest conflicting with @types/mocha #50

bryan-codaio opened this issue Nov 17, 2023 · 3 comments

Comments

@bryan-codaio
Copy link

bryan-codaio commented Nov 17, 2023

Describe the bug
In our repo we have mocha-based unit tests and jest-based storybook tests. @storybook/[email protected] (namely #34) added @types/[email protected] as a dependency, which causes typescript to break quite thoroughly due to duplicate and conflicting definitions of (for example) it and afterEach.

To Reproduce
I don't have a minimal repro repo handy - if that's useful LMK and I can create one. I believe it ought to be trivial to reproduce this issue, though.

It may matter that we're using pnpm to install these packages, since (to my understanding) that means hoisting doesn't play a part.

Expected behavior
@storybook/jest should not pull in types that break a codebase that otherwise uses mocha for its testing.

Screenshots
N/A

System

Storybook Environment Info:

  System:
    OS: macOS 13.6.1
    CPU: (10) arm64 Apple M1 Max
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 20.8.0 - ~/src/coda/build/node/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.1.0 - ~/src/coda/build/node/bin/npm
    pnpm: 8.6.9 - ~/src/coda/build/node/bin/pnpm <----- active
  Browsers:
    Chrome: 119.0.6045.159
    Safari: 17.1
  npmPackages:
    @storybook/addon-a11y: 7.0.18 => 7.0.18
    @storybook/addon-actions: 7.0.18 => 7.0.18
    @storybook/addon-coverage: 0.0.8 => 0.0.8
    @storybook/addon-docs: 7.0.18 => 7.0.18
    @storybook/addon-essentials: 7.0.18 => 7.0.18
    @storybook/addon-interactions: 7.0.18 => 7.0.18
    @storybook/addon-links: 7.0.18 => 7.0.18
    @storybook/addons: 7.0.18 => 7.0.18
    @storybook/components: 7.0.18 => 7.0.18
    @storybook/csf: 0.1.1 => 0.1.1
    @storybook/jest: 0.1.0 => 0.1.0
    @storybook/react: 7.0.18 => 7.0.18
    @storybook/react-webpack5: 7.0.18 => 7.0.18
    @storybook/test-runner: 0.10.0 => 0.10.0
    @storybook/testing-library: 0.2.2 => 0.2.2
    @storybook/types: 7.0.18 => 7.0.18
    chromatic: 6.24.1 => 6.24.1
    eslint-plugin-storybook: ^0.6.12 => 0.6.12
    storybook: 7.0.18 => 7.0.18

Additional context
I'm not familiar with authoring libraries - I don't suppose it's as simple as having @types/jest be in devDependencies rather than dependencies?

@IanVS
Copy link
Member

IanVS commented Nov 17, 2023

A reproduction would indeed be handy, it's tough to say exactly what's happening without one.

@IanVS
Copy link
Member

IanVS commented Nov 17, 2023

You could also try out @storybook/test instead: https://storybook.js.org/blog/storybook-test/

@yannbf
Copy link
Member

yannbf commented May 16, 2024

Hey everyone! In Storybook 8, this package functionality has been integrated to a new package called @storybook/test, which uses Vitest APIs for an improved experience. This issue should be solved or maybe it's not applicable anymore.

When upgrading to Storybook 8 with npx storybook@latest upgrade, you will get prompted and will get an automigration for the new package. Please migrate when you can! Thanks a lot <3

@yannbf yannbf closed this as completed May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants