We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a project containing both server and client code. So I want to run tests also in node.
node
When I run vitest, I get Cannot read properties of undefined (reading 'navigator') error:
vitest
Cannot read properties of undefined (reading 'navigator')
TypeError: Cannot read properties of undefined (reading 'navigator') ❯ resetClipboardStubOnView node_modules/.pnpm/@[email protected][email protected]/node_modules/@storybook/test/dist/index.mjs:178:7052 ❯ node_modules/.pnpm/@[email protected][email protected]/node_modules/@storybook/test/dist/index.mjs:178:8238
This occurs when I set test.globals: true in vite.config.ts.
test.globals: true
vite.config.ts
https://github.com/cyberuni/sb-test-nav
run pnpm test
pnpm test
npx storybook@latest info
Storybook Environment Info:
System: OS: macOS 14.7 CPU: (10) arm64 Apple M1 Pro Shell: 5.9 - /bin/zsh Binaries: Node: 22.9.0 - ~/.local/state/fnm_multishells/74613_1728508612022/bin/node Yarn: 1.22.21 - ~/.nvm/versions/node/v20.12.2/bin/yarn npm: 10.8.3 - ~/.local/state/fnm_multishells/74613_1728508612022/bin/npm <----- active pnpm: 8.15.6 - ~/.nvm/versions/node/v20.12.2/bin/pnpm Browsers: Chrome: 129.0.6668.90 Safari: 18.0 npmPackages: @storybook/addon-essentials: ^8.3.5 => 8.3.5 @storybook/addon-interactions: ^8.3.5 => 8.3.5 @storybook/addon-links: ^8.3.5 => 8.3.5 @storybook/addon-onboarding: ^8.3.5 => 8.3.5 @storybook/blocks: ^8.3.5 => 8.3.5 @storybook/react: ^8.3.5 => 8.3.5 @storybook/react-vite: ^8.3.5 => 8.3.5 @storybook/test: ^8.3.5 => 8.3.5 eslint-plugin-storybook: ^0.9.0 => 0.9.0 storybook: ^8.3.5 => 8.3.5
The @storybook/test is probably doing some work at load time which is not ideal.
@storybook/test
It should avoid that or at least check for window?...
window?...
The text was updated successfully, but these errors were encountered:
want to work on this @unional ,please assign it to me
Sorry, something went wrong.
@Siddhant-Kashyap No need to assign. If you make a PR we'd be happy to review
No branches or pull requests
Describe the bug
I have a project containing both server and client code.
So I want to run tests also in
node
.When I run
vitest
, I getCannot read properties of undefined (reading 'navigator')
error:This occurs when I set
test.globals: true
invite.config.ts
.Reproduction link
https://github.com/cyberuni/sb-test-nav
Reproduction steps
run
pnpm test
System
npx storybook@latest info
Storybook Environment Info:
System:
OS: macOS 14.7
CPU: (10) arm64 Apple M1 Pro
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.9.0 - ~/.local/state/fnm_multishells/74613_1728508612022/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v20.12.2/bin/yarn
npm: 10.8.3 - ~/.local/state/fnm_multishells/74613_1728508612022/bin/npm <----- active
pnpm: 8.15.6 - ~/.nvm/versions/node/v20.12.2/bin/pnpm
Browsers:
Chrome: 129.0.6668.90
Safari: 18.0
npmPackages:
@storybook/addon-essentials: ^8.3.5 => 8.3.5
@storybook/addon-interactions: ^8.3.5 => 8.3.5
@storybook/addon-links: ^8.3.5 => 8.3.5
@storybook/addon-onboarding: ^8.3.5 => 8.3.5
@storybook/blocks: ^8.3.5 => 8.3.5
@storybook/react: ^8.3.5 => 8.3.5
@storybook/react-vite: ^8.3.5 => 8.3.5
@storybook/test: ^8.3.5 => 8.3.5
eslint-plugin-storybook: ^0.9.0 => 0.9.0
storybook: ^8.3.5 => 8.3.5
Additional context
The
@storybook/test
is probably doing some work at load time which is not ideal.It should avoid that or at least check for
window?...
The text was updated successfully, but these errors were encountered: