Skip to content

Mocha 6 fails with pnpm: Cannot find module 'semver' #3868

@gilly3

Description

@gilly3

Prerequisites

  • Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

mocha 6 fails to run under pnpm

Steps to Reproduce

  1. pnpm install mocha
  2. pnpx mocha --version or npx mocha --version

Expected behavior:

6.1.2 is displayed in the console

Actual behavior:

Cannot find module 'semver' is displayed in the console

Reproduces how often:

100%

Versions

6.1.2

  • The output of mocha --version and node node_modules/.bin/mocha --version:
    Cannot find module 'semver'
  • The output of node --version:
    v8.15.1
  • Your operating system
    • name and version: Ubuntu 14, Windows 10
    • architecture (32 or 64-bit): 64, 64
  • Your shell (e.g., bash, zsh, PowerShell, cmd): bash, Powershell, git bash
  • Your browser and version (if running browser tests): N/A
  • Any third-party Mocha-related modules (and their versions): N/A
  • Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version): N/A

Additional Information

A mocha dependency, node-environment-flags, requires semver, but does not list it as a dependency in package.json. See issue: boneskull/node-environment-flags#2 and pull request: boneskull/node-environment-flags#4.

Metadata

Metadata

Assignees

Labels

type: buga defect, confirmed by a maintainer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions