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

[Bug] Issue with composeStories when used with Vitest in Storybook 7 #9

Closed
K3TH3R opened this issue Jan 20, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@K3TH3R
Copy link

K3TH3R commented Jan 20, 2023

Describe the bug

I've been starting to migrate our Vite/Vue 3 repo over to Storybook 7 and I'm running into a weird error as soon as I import composeStories into a test file.

Simply by adding the following lines:

import * as stories from './BasicButton.stories.js'
import { composeStories } from '@storybook/testing-vue3'
const composed = composeStories(stories)

I get the following error:

 FAIL  src/components/BasicButton/BasicButton.spec.ts [ src/components/BasicButton/BasicButton.spec.ts ]
TypeError: addons__default.setChannel is not a function
 ❯ Object.<anonymous> node_modules/@storybook/testing-vue3/src/index.ts:11:8
 ❯ Object.<anonymous> node_modules/@storybook/testing-vue3/dist/index.js:7:20

Which seems to be happening here. I have @storybook/addons installed, but I assume it might be expecting an instance of Storybook that wouldn't be running when we're doing unit tests outside of Storybook?

Steps to reproduce the behavior

  1. I've created a sample repo here: https://github.com/K3TH3R/composeStories-issue-storybook-7
  2. If you clone/install and then run yarn test:unit, you should see the error.
  3. If you comment out this line you should see the test finish as expected.

Expected behavior

I would expect to be able to run this properly. This exact setup is working as expected when we're on Storybook v6.

Environment

  • OS: Mac OS
  • Node.js version: 16.19.0
  • NPM version: 8.19.3
@yannbf
Copy link
Member

yannbf commented Apr 21, 2023

Hey there, this was fixed in v0.0.2, please try it out and reopen the issue if it didn't work. Thank you!

@yannbf yannbf closed this as completed Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants