storybook: [Bug]: Failed to start Vitest from Storybook 9's Browser

Describe the bug

Hi there, I have a yarn pnp project ( v 4.5.1) and I am using storybook 9.1.0-alpha.1 (but i have tried this in other 9.x versions) and whenever i try to run interaction tests from the browser using vitest i get this error in the console:

Error: Failed to start Vitest storybook/test: Error: at Vitest._setServer (file:///C:/repos/hl-ui-library/.yarn/__virtual__/vitest-virtual-93d35170d9/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:8926:11) at async handler (file:///C:/repos/hl-ui-library/.yarn/__virtual__/vitest-virtual-93d35170d9/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:9840:6) at async _createServer (file:///C:/repos/hl-ui-library/.yarn/__virtual__/vite-virtual-afe914521a/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vite-npm-6.3.5-244c1b4d55-10c0.zip/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:38657:20) at async createViteServer (file:///C:/repos/hl-ui-library/.yarn/__virtual__/vitest-virtual-93d35170d9/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:6873:17) at async createVitest (file:///C:/repos/hl-ui-library/.yarn/__virtual__/vitest-virtual-93d35170d9/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:9881:17) at async VitestManager.startVitest (file:///C:/repos/hl-ui-library/.yarn/__virtual__/@storybook-addon-vitest-virtual-5a40e5cf2e/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/@storybook-addon-vitest-npm-9.1.0-alpha.1-615a3aab29-10c0.zip/node_modules/@storybook/addon-vitest/dist/node/vitest.mjs:14:8330)

I have also tried this in a non yarn pnp project and get the same issues. I have tried cleaning cache, nuking and reinstalling and still have the same issues. It worked in my SB 8.6.14 with the experimental vitest addon but as soon as i go to 9 and use the renamed addon it breaks. Storybook 9 itself works and if i run the cli test runner using ‘vitest --project=storybook’ in version 9 it works just fine. this is only when I run it from the storybook’s browser UI

Reproduction link

Reproduction steps

  • Pull down any of the three repos above and run either yarn install or npm install
  • Run [yarn|npm] run storybook
  • Try and run tests from the browser for interaction tests
  • All three of them throw the same error
  • All three of them have storybook 9.0.2

System

Storybook Environment Info:

  System:
    OS: Windows 11 10.0.26100
    CPU: (22) x64 Intel(R) Core(TM) Ultra 7 165H
  Binaries:
    Node: 22.9.0 - ~\AppData\Local\Temp\xfs-a2fa8df0\node.CMD
    Yarn: 4.5.1 - ~\AppData\Local\Temp\xfs-a2fa8df0\yarn.CMD <----- active
    npm: 11.2.0 - C:\nvm4w\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (134.0.3124.93)

Additional context

I have tried multiple ways to see if maybe the auto upgrade/migration failed. I deleted all storybook packages and logs and references and reinstalled it manually, i created new test projects with yarn pnp and just npm and it still failed. Nothing I do seems to get it to work

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 22 (5 by maintainers)

Most upvoted comments

Yes, I have the same issue. Using Turborepo and PNPM and always get

Error

Failed to start Vitest

No projects matched the filter "storybook:C:/Users/.../.storybook".

Found a fix/workaround on my project.

If you want to use the Storybook UI to start your tests, it looks like Storybook expects that your project to be named storybook/test.

So in your vite.config.ts file make sure you have this :

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import path from 'node:path';
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';

export default defineConfig({
	plugins: [sveltekit()],
	test: {
		projects: [
			{
				extends: true,
				plugins: [
					storybookTest({
						configDir: path.join(__dirname, '.storybook'),
						storybookScript: 'pnpm storybook --no-open'
					})
				],
				test: {
					name: 'storybook/test', // This is where you specify the name of your project and this is what storybook expects
					browser: {
						enabled: true,
						headless: true,
						provider: 'playwright',
						instances: [
							{
								browser: 'chromium'
							}
						]
					},
					setupFiles: ['.storybook/vitest.setup.ts']
				}
			}
		]
	},
});

As mentioned earlier, this problem also still exists, using import { storybookTest } from '@storybook/addon-vitest/vitest-plugin'

TS2614: Module ‘@storybook/addon-vitest/vitest-plugin’ has no exported member storybookTest.

Hello,

It looks like it’s still not fixed in the last version of Storybook.

Error

Failed to start Vitest

No projects matched the filter "storybook:C:/Users/xxx/Desktop/dev/sveltestorybooktest/.storybook".

With these dependencies :

    "@storybook/addon-a11y": "^9.0.6",
    "@storybook/addon-docs": "^9.0.6",
    "@storybook/addon-svelte-csf": "^5.0.3",
    "@storybook/addon-vitest": "^9.0.6",
    "@storybook/sveltekit": "^9.0.6",
    "storybook": "^9.0.6",
    "vite": "^6.3.5",
    "vitest": "^3.2.3"

I recreated a stripped down version of the repo im working on as well as two brand new repos from scratch (one for yarn pnp and one for npm). The stripped down repo has all the same packages that I use for our internal project, but I just removed a few components and github package/publishing workflows and information as that isn’t relevant. I upgraded it to 9 and if you pull it down and run it you should be able to reproduce the error. I couldnt put it on storybook.new as it wouldnt let me set up yarn pnp on there so i had to do it this way.

Both new installations failed when it tried to install @chromatic-com/storybook so I had to manually install that first and then run the [pkgmanager] create storybook command.

Then when trying to run the tests from the browser, all three of these repos return the same error as below:

Image

storybook/test: Error: Failed to start Vitest
storybook/test: Error:
    at Vitest._setServer (file:///C:/repos/sb-9-migration/.yarn/__virtual__/vitest-virtual-f45947eae1/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:8926:11)
    at async handler (file:///C:/repos/sb-9-migration/.yarn/__virtual__/vitest-virtual-f45947eae1/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:9840:6)
    at async _createServer (file:///C:/repos/sb-9-migration/.yarn/__virtual__/vite-virtual-a58ec23678/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vite-npm-6.3.5-244c1b4d55-10c0.zip/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:38657:20)
    at async createViteServer (file:///C:/repos/sb-9-migration/.yarn/__virtual__/vitest-virtual-f45947eae1/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:6873:17)
    at async createVitest (file:///C:/repos/sb-9-migration/.yarn/__virtual__/vitest-virtual-f45947eae1/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:9881:17)
    at async VitestManager.startVitest (file:///C:/repos/sb-9-migration/.yarn/__virtual__/@storybook-addon-vitest-virtual-9cafae532f/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/@storybook-addon-vitest-npm-9.1.0-alpha.1-615a3aab29-10c0.zip/node_modules/@storybook/addon-vitest/dist/node/vitest.mjs:14:8330)
storybook/test: Error: Failed to start test runner process
storybook/test: Error: Aborting test runner process because it took longer than 30 seconds to start.
    at C:\repos\sb-9-migration\.yarn\__virtual__\@storybook-addon-vitest-virtual-9cafae532f\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\@storybook-addon-vitest-npm-9.1.0-alpha.1-615a3aab29-10c0.zip\node_modules\@storybook\addon-vitest\dist\preset.js:30:7353
    at new Promise (<anonymous>)
    at bootTestRunner (C:\repos\sb-9-migration\.yarn\__virtual__\@storybook-addon-vitest-virtual-9cafae532f\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\@storybook-addon-vitest-npm-9.1.0-alpha.1-615a3aab29-10c0.zip\node_modules\@storybook\addon-vitest\dist\preset.js:30:7296)
    at runTestRunner (C:\repos\sb-9-migration\.yarn\__virtual__\@storybook-addon-vitest-virtual-9cafae532f\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\@storybook-addon-vitest-npm-9.1.0-alpha.1-615a3aab29-10c0.zip\node_modules\@storybook\addon-vitest\dist\preset.js:30:7892)
    at C:\repos\sb-9-migration\.yarn\__virtual__\@storybook-addon-vitest-virtual-9cafae532f\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\@storybook-addon-vitest-npm-9.1.0-alpha.1-615a3aab29-10c0.zip\node_modules\@storybook\addon-vitest\dist\preset.js:34:914
    at C:\repos\sb-9-migration\.yarn\__virtual__\storybook-virtual-42145293fa\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-9.1.0-alpha.1-28a83e38a2-10c0.zip\node_modules\storybook\dist\core-server\index.cjs:36488:14
    at Array.forEach (<anonymous>)
    at e.emitToListeners (C:\repos\sb-9-migration\.yarn\__virtual__\storybook-virtual-42145293fa\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-9.1.0-alpha.1-28a83e38a2-10c0.zip\node_modules\storybook\dist\core-server\index.cjs:36487:34)
    at e.handleChannelEvents (C:\repos\sb-9-migration\.yarn\__virtual__\storybook-virtual-42145293fa\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-9.1.0-alpha.1-28a83e38a2-10c0.zip\node_modules\storybook\dist\core-server\index.cjs:36551:10)
    at C:\repos\sb-9-migration\.yarn\__virtual__\storybook-virtual-42145293fa\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-9.1.0-alpha.1-28a83e38a2-10c0.zip\node_modules\storybook\dist\channels\index.cjs:1734:9
    at Array.forEach (<anonymous>)
    at U.handleEvent (C:\repos\sb-9-migration\.yarn\__virtual__\storybook-virtual-42145293fa\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-9.1.0-alpha.1-28a83e38a2-10c0.zip\node_modules\storybook\dist\channels\index.cjs:1733:24)
    at Lm.handler (C:\repos\sb-9-migration\.yarn\__virtual__\storybook-virtual-42145293fa\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-9.1.0-alpha.1-28a83e38a2-10c0.zip\node_modules\storybook\dist\channels\index.cjs:1679:32)
    at WebSocket.<anonymous> (C:\repos\sb-9-migration\.yarn\__virtual__\storybook-virtual-42145293fa\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-9.1.0-alpha.1-28a83e38a2-10c0.zip\node_modules\storybook\dist\core-server\index.cjs:36592:23)
    at WebSocket.emit (node:events:519:28)
    at Receiver.receiverOnMessage (C:\repos\sb-9-migration\.yarn\__virtual__\ws-virtual-b5288a90bf\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\websocket.js:1220:20)
    at Receiver.emit (node:events:519:28)
    at Receiver.dataMessage (C:\repos\sb-9-migration\.yarn\__virtual__\ws-virtual-b5288a90bf\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\receiver.js:596:14)
    at Receiver.getData (C:\repos\sb-9-migration\.yarn\__virtual__\ws-virtual-b5288a90bf\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\receiver.js:496:10)
    at Receiver.startLoop (C:\repos\sb-9-migration\.yarn\__virtual__\ws-virtual-b5288a90bf\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\receiver.js:167:16)
    at Receiver._write (C:\repos\sb-9-migration\.yarn\__virtual__\ws-virtual-b5288a90bf\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\receiver.js:94:10)
    at writeOrBuffer (node:internal/streams/writable:572:12)
    at _write (node:internal/streams/writable:501:10)
    at Writable.write (node:internal/streams/writable:510:10)
    at Socket.socketOnData (C:\repos\sb-9-migration\.yarn\__virtual__\ws-virtual-b5288a90bf\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\websocket.js:1355:35)
    at Socket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
Chromatic: Unhandled promise rejection: {"sanitizedErr":{}}

I’m not sure if its a vitest config error or if its something else but my storybook version 8 with the experimental vitest plugin works with the exact some config (just with updated import paths of course).

And I am not sure if this is related/unrelated:

TS2614: Module '@storybook/addon-vitest/vitest-plugin' has no exported member storybookTest.

Image|

ahh! @sfrisk thank you so much! I will try that and report back 😃

nope that didn’t work. i was actually on a higher version than that (^6.3.5) but I lowered it and still not working for me

Yes, I have the same issue. Using Turborepo and PNPM and always get

Error

Failed to start Vitest

No projects matched the filter "storybook:C:/Users/.../.storybook".

Hey folks,

please try out the following canary release and report back whether it fixes the issue for you: 0.0.0-pr-31630-sha-13817eb5

updated all storybook related packages in all my projects i listed above to 0.0.0-pr-31630-sha-13817eb5 and still get this error:

This is the Error from the Browser modal:

Error

Failed to start Vitest

No projects matched the filter "storybook:C:/repos/storybook-nine-test-project/.storybook".

Error: 
    at Vitest._setServer (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vitest-virtual-2d8ce5d454/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:8926:11)
    at async handler (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vitest-virtual-2d8ce5d454/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:9840:6)
    at async _createServer (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vite-virtual-8b82aa1ec0/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vite-npm-6.3.5-244c1b4d55-10c0.zip/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:38657:20)
    at async createViteServer (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vitest-virtual-2d8ce5d454/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:6873:17)
    at async createVitest (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vitest-virtual-2d8ce5d454/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:9881:17)
    at async VitestManager.startVitest (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/@storybook-addon-vitest-virtual-542874e0ee/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/@storybook-addon-vitest-npm-0.0.0-pr-31630-sha-13817eb5-32dc82a9f2-10c0.zip/node_modules/@storybook/addon-vitest/dist/node/vitest.mjs:14:8330)



Troubleshoot: https://storybook.js.org/docs/0.0/writing-tests/integrations/vitest-addon/?renderer=react#what-happens-if-vitest-itself-has-an-error

This is the error from the console in the cli:

storybook/test: info
storybook/test: Using tsconfig paths for react-docgen
storybook/test: Error: Failed to start Vitest
storybook/test: Error:
    at Vitest._setServer (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vitest-virtual-2d8ce5d454/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:8926:11)
    at async handler (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vitest-virtual-2d8ce5d454/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:9840:6)
    at async _createServer (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vite-virtual-8b82aa1ec0/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vite-npm-6.3.5-244c1b4d55-10c0.zip/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:38657:20)
    at async createViteServer (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vitest-virtual-2d8ce5d454/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:6873:17)
    at async createVitest (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/vitest-virtual-2d8ce5d454/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/vitest-npm-3.1.4-b43587cccf-10c0.zip/node_modules/vitest/dist/chunks/cli-api.BzebkJv7.js:9881:17)
    at async VitestManager.startVitest (file:///C:/repos/storybook-nine-test-project/.yarn/__virtual__/@storybook-addon-vitest-virtual-542874e0ee/3/Users/jghelani/AppData/Local/Yarn/Berry/cache/@storybook-addon-vitest-npm-0.0.0-pr-31630-sha-13817eb5-32dc82a9f2-10c0.zip/node_modules/@storybook/addon-vitest/dist/node/vitest.mjs:14:8330)
storybook/test: Error: Failed to start test runner process
storybook/test: Error: Aborting test runner process because it took longer than 30 seconds to start.
    at C:\repos\storybook-nine-test-project\.yarn\__virtual__\@storybook-addon-vitest-virtual-542874e0ee\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\@storybook-addon-vitest-npm-0.0.0-pr-31630-sha-13817eb5-32dc82a9f2-10c0.zip\node_modules\@storybook\addon-vitest\dist\preset.js:30:7364
    at new Promise (<anonymous>)
    at bootTestRunner (C:\repos\storybook-nine-test-project\.yarn\__virtual__\@storybook-addon-vitest-virtual-542874e0ee\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\@storybook-addon-vitest-npm-0.0.0-pr-31630-sha-13817eb5-32dc82a9f2-10c0.zip\node_modules\@storybook\addon-vitest\dist\preset.js:30:7307)
    at runTestRunner (C:\repos\storybook-nine-test-project\.yarn\__virtual__\@storybook-addon-vitest-virtual-542874e0ee\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\@storybook-addon-vitest-npm-0.0.0-pr-31630-sha-13817eb5-32dc82a9f2-10c0.zip\node_modules\@storybook\addon-vitest\dist\preset.js:30:7903)
    at C:\repos\storybook-nine-test-project\.yarn\__virtual__\@storybook-addon-vitest-virtual-542874e0ee\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\@storybook-addon-vitest-npm-0.0.0-pr-31630-sha-13817eb5-32dc82a9f2-10c0.zip\node_modules\@storybook\addon-vitest\dist\preset.js:34:914
    at C:\repos\storybook-nine-test-project\.yarn\__virtual__\storybook-virtual-f6db3b0305\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-0.0.0-pr-31630-sha-13817eb5-3c38433549-10c0.zip\node_modules\storybook\dist\core-server\index.cjs:36488:14
    at Array.forEach (<anonymous>)
    at e.emitToListeners (C:\repos\storybook-nine-test-project\.yarn\__virtual__\storybook-virtual-f6db3b0305\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-0.0.0-pr-31630-sha-13817eb5-3c38433549-10c0.zip\node_modules\storybook\dist\core-server\index.cjs:36487:34)
    at e.handleChannelEvents (C:\repos\storybook-nine-test-project\.yarn\__virtual__\storybook-virtual-f6db3b0305\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-0.0.0-pr-31630-sha-13817eb5-3c38433549-10c0.zip\node_modules\storybook\dist\core-server\index.cjs:36551:10)
    at C:\repos\storybook-nine-test-project\.yarn\__virtual__\storybook-virtual-f6db3b0305\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-0.0.0-pr-31630-sha-13817eb5-3c38433549-10c0.zip\node_modules\storybook\dist\channels\index.cjs:1734:9
    at Array.forEach (<anonymous>)
    at U.handleEvent (C:\repos\storybook-nine-test-project\.yarn\__virtual__\storybook-virtual-f6db3b0305\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-0.0.0-pr-31630-sha-13817eb5-3c38433549-10c0.zip\node_modules\storybook\dist\channels\index.cjs:1733:24)
    at Lm.handler (C:\repos\storybook-nine-test-project\.yarn\__virtual__\storybook-virtual-f6db3b0305\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-0.0.0-pr-31630-sha-13817eb5-3c38433549-10c0.zip\node_modules\storybook\dist\channels\index.cjs:1679:32)
    at WebSocket.<anonymous> (C:\repos\storybook-nine-test-project\.yarn\__virtual__\storybook-virtual-f6db3b0305\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\storybook-npm-0.0.0-pr-31630-sha-13817eb5-3c38433549-10c0.zip\node_modules\storybook\dist\core-server\index.cjs:36592:23)
    at WebSocket.emit (node:events:519:28)
    at Receiver.receiverOnMessage (C:\repos\storybook-nine-test-project\.yarn\__virtual__\ws-virtual-e2ebc7fe7d\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\websocket.js:1220:20)
    at Receiver.emit (node:events:519:28)
    at Receiver.dataMessage (C:\repos\storybook-nine-test-project\.yarn\__virtual__\ws-virtual-e2ebc7fe7d\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\receiver.js:596:14)
    at Receiver.getData (C:\repos\storybook-nine-test-project\.yarn\__virtual__\ws-virtual-e2ebc7fe7d\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\receiver.js:496:10)
    at Receiver.startLoop (C:\repos\storybook-nine-test-project\.yarn\__virtual__\ws-virtual-e2ebc7fe7d\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\receiver.js:167:16)
    at Receiver._write (C:\repos\storybook-nine-test-project\.yarn\__virtual__\ws-virtual-e2ebc7fe7d\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\receiver.js:94:10)
    at writeOrBuffer (node:internal/streams/writable:572:12)
    at _write (node:internal/streams/writable:501:10)
    at Writable.write (node:internal/streams/writable:510:10)
    at Socket.socketOnData (C:\repos\storybook-nine-test-project\.yarn\__virtual__\ws-virtual-e2ebc7fe7d\3\Users\jghelani\AppData\Local\Yarn\Berry\cache\ws-npm-8.18.2-664b945bea-10c0.zip\node_modules\ws\lib\websocket.js:1355:35)
    at Socket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
Chromatic: Unhandled promise rejection: {"sanitizedErr":{}}

Hello,

Ran into the same issue. Seems to be the issue with project filtering. Specifically Vitest -> matchesProjectFilter. Generated regex by wildcardPatternToRegExp: ^storybook:C:\\Users\\...\\...\\.storybook$ Tests against:

  • storybook:/C:/Users/.../.../.storybook
  • storybook:/C:/Users/.../.../.storybook (chromium)

Do you a have a reproduction repo you can share? If not, can you create one? Go to https://storybook.new or see repro docs. Thank you! 🙏

Sorry it didn’t work. Guess that means I get to open up my own bug report then.