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

Investigate "nyc"-related failure while running test-coverage npm script on travis windows workers #1739

Open
rpl opened this issue Oct 25, 2019 · 1 comment

Comments

@rpl
Copy link
Member

rpl commented Oct 25, 2019

In some recent Pull Requests, the travis CI job running on windows is failing with the following error message:

Running mocha unit tests...
----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|
The command "npm run test-coverage" exited with 1.
internal/modules/cjs/loader.js:638
    throw err;
    ^
Error: Cannot find module 'C:\Users\travis\build\mozilla\web-ext\node'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

After some tests to be able to bisect what combination of node, npm and nyc is able to trigger the issue, I've been able to reproduce the same failure locally consistently and it looks related to something going wrong between nyc and the particular npm version being used (sigh :°-| ).

To identify the npm version that starts to trigger this issue I've executed the following command on windows 10 and git bash on multiple npm versions:

$ export NPMV=NN.N.N; rm -rf node_modules/; npx npm@$NPMV ci && npx npm@$NPMV run test-coverage

with the following results:

- npm@6.4.1 => OK
- npm@6.5.0 => OK
- npm@6.6.0 => OK
- npm@6.10.3 => OK
- npm@6.11.0 => BROKEN but different error
- npm@6.11.3 => BROKEN
- npm@6.12.0 => BROKEN

On npm@6.11.0 the error is:

> web-ext@3.2.0 test-coverage D:\MOZLAB\web-ext
> nyc npm run test

'find_dp0' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:573
    throw err;
    ^

Error: Cannot find module 'D:\nyc\bin\nyc.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
    at Function.Module._load (internal/modules/cjs/loader.js:497:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
    at startup (internal/bootstrap/node.js:228:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:575:3)

It also worth to notice that the issue looks to be actually introduced in the "npm ci" step, because running a version that wasn't affected based on the test described above on the node_modules/ directory created with an affected version leads to the same error.

@rpl
Copy link
Member Author

rpl commented Oct 25, 2019

#1738 and #1731 are two of the pull requests that are currently blocked by this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant