[bug] --failOnConsole not working with Mock Service Worker
Describe the bug
--failOnConsole test parameter is not working (if a test finishes too fast)
To Reproduce Steps to reproduce the behavior:
clone this repo
git clone https://github.com/ts213/storybook-test-bug
install deps
npm i
launch storybook server
npm run storybook
open a browser console on a newly opened page and verify that the console contains the error:
[MSW] Error: captured a request without a matching request handler....
now run the test-storybook command:
npm run test-storybook -- --failOnConsole
test successfully passes:
Test Suites: 1 passed, 1 total
Expected behavior Test should fail.
System
Please paste the results of npx storybook@latest info here.
Storybook Environment Info:
System:
OS: Linux 5.14
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Shell: 4.4.23 - /bin/bash
Binaries:
Node: 18.12.1 - ~/.local/bin/node
npm: 8.19.2 - ~/.local/bin/npm <----- active
npmPackages:
@storybook/addon-essentials: ^7.5.2 => 7.5.2
@storybook/addon-interactions: ^7.5.2 => 7.5.2
@storybook/addon-links: ^7.5.2 => 7.5.2
@storybook/blocks: ^7.5.2 => 7.5.2
@storybook/test-runner: ^0.16.0 => 0.16.0
@storybook/testing-library: ^0.2.2 => 0.2.2
@storybook/vue3: ^7.5.2 => 7.5.2
@storybook/vue3-vite: ^7.5.2 => 7.5.2
eslint-plugin-storybook: ^0.6.15 => 0.6.15
msw-storybook-addon: ^1.10.0 => 1.10.0
storybook: ^7.6.5 => 7.6.5
Additional context
I can make test fail if I deliberately delay a test:
uncomment this line await new Promise((resolve, reject) => setTimeout(resolve, 1100));
in src/stories/Page.stories.js