Skip to content

[Bug?]: Issue with pnp not recognizing node 12.22+ dynamic import used by Mocha v9 #3163

@Drethic

Description

@Drethic

Self-service

  • I'd be willing to implement a fix

Describe the bug

After upgrading to mocha v9.0.2 all tests started to fail. I worked with the mocha developers and they came to the conclusion that yarn pnp may not be recognizing CJS dynamic imports available with node v12.22+. Here are the details of the diagnostics by the mocha devs: mochajs/mocha#4693.

To reproduce

Link to demo repo.

  1. Clone demo repo
  2. Run yarn install to install mocha, chai, and their dependencies
  3. Run yarn test and the console will return 0 passing (1ms)

Environment

System:
OS: macOS 11.4
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 14.15.5 - /private/var/folders/9n/y6fxtvls1w776645zpdf4n6n6qrsvq/T/xfs-b99b3208/node
Yarn: 2.4.2 - /private/var/folders/9n/y6fxtvls1w776645zpdf4n6n6qrsvq/T/xfs-b99b3208/yarn
npm: 6.14.11 - /usr/local/bin/npm

Additional context

Currently yarn test for "Validating Mocha" are also failing silently. Potentially because of this issue. Here is an example.
No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupholdedReal issues without formal reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions