Skip to content
New issue

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

test-storybook --coverage cmd fails with pnpm #266

Closed
qwerdee opened this issue Feb 23, 2023 · 2 comments · Fixed by #364
Closed

test-storybook --coverage cmd fails with pnpm #266

qwerdee opened this issue Feb 23, 2023 · 2 comments · Fixed by #364
Labels
bug Something isn't working released

Comments

@qwerdee
Copy link

qwerdee commented Feb 23, 2023

Describe the bug

Coverage report fails when using pnpm as package manager. test-storybook command runs npx nyc .. internally which does not work

Steps to reproduce the behavior

  1. Set up storybook with addon test-runner and addon-coverage
  2. install dependencies via pnpm
  3. run test-storybook with coverage pnpm test-storybook --coverage

Expected behavior

Should not fail and nvm should be executed with pnpx ... instead of npx ... in a a pnpm project

Screenshots and/or logs

$ pnpm test-storybook -c libs/ui/.storybook --url=http://localhost:4400 --coverage
 PASS   browser: chromium  libs/ui/src/lib/Button/Button.stories.tsx
  UI/Button
    Primary
      ✓ smoke-test (58 ms)
    PrimaryHover
      ✓ smoke-test (23 ms)
    PrimaryFocus
      ✓ smoke-test (19 ms)
    PrimaryDisabled
      ✓ smoke-test (18 ms)
    PrimaryLoading
      ✓ smoke-test (16 ms)
    Secondary
      ✓ smoke-test (16 ms)
    SecondaryHover
      ✓ smoke-test (17 ms)
    SecondaryFocus
      ✓ smoke-test (14 ms)
    SecondaryDisabled
      ✓ smoke-test (15 ms)
    SecondaryLoading
      ✓ smoke-test (12 ms)
    Tertiary
      ✓ smoke-test (15 ms)
    TertiaryHover
      ✓ smoke-test (14 ms)
    TertiaryFocus
      ✓ smoke-test (16 ms)
    TertiaryDisabled
      ✓ smoke-test (16 ms)
    TertiaryLoading
      ✓ smoke-test (15 ms)

Coverage file (26504 bytes) written to .nyc_output/coverage.json
Test Suites: 1 passed, 1 total
Tests:       15 passed, 15 total
Snapshots:   0 total
Time:        1.941 s, estimated 4 s
Ran all test suites.
sh: nyc: command not found
node:internal/errors:868
  const err = new Error(message);
              ^

Error: Command failed: npx nyc report --reporter=text -t /{pathtoproject}/coverage/storybook --report-dir /{pathtoproject}/coverage/storybook
    at checkExecSyncError (node:child_process:885:11)
    at execSync (node:child_process:957:15)
    at reportCoverage (/{pathtoproject}/node_modules/.pnpm/@storybook+test-runner@0.9.4_daqb7etzijemrfnwu5gw5hgeli/node_modules/@storybook/test-runner/bin/test-storybook.js:81:3)
    at process.onProcessEnd (/{pathtoproject}/node_modules/.pnpm/@storybook+test-runner@0.9.4_daqb7etzijemrfnwu5gw5hgeli/node_modules/@storybook/test-runner/bin/test-storybook.js:88:3)
    at process.emit (node:events:525:35) {
  status: 127,
  signal: null,
  output: [ null, null, null ],
  pid: 91161,
  stdout: null,
  stderr: null
}

Node.js v18.13.0

Environment

  • OS: MacOs
  • Node.js version: v18.13.0
  • PNPM version: 7.26.3
@qwerdee qwerdee added the bug Something isn't working label Feb 23, 2023
@qwerdee
Copy link
Author

qwerdee commented Feb 23, 2023

Maybe useful resource for package manager detection: https://github.com/nrwl/nx/blob/master/packages/nx/src/utils/package-manager.ts

Copy link

github-actions bot commented Nov 8, 2023

🚀 Issue was released in v0.14.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
1 participant