Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

'npm run coverage' errors; breaks checks for node v15 #146

Closed
trentm opened this issue Mar 29, 2021 · 1 comment · Fixed by #148
Closed

'npm run coverage' errors; breaks checks for node v15 #146

trentm opened this issue Mar 29, 2021 · 1 comment · Fixed by #148
Labels
agent-nodejs Make available for APM Agents project planning.

Comments

@trentm
Copy link
Member

trentm commented Mar 29, 2021

Starting at least last Friday I'm seeing errors like the following from running code coverage: npm run coverage

With node v14 sometimes this:

% npm run coverage

> elastic-apm-http-client@9.6.0 coverage /Users/trentm/el/apm-nodejs-http-client2
> nyc report --reporter=text-lcov > coverage.lcov && codecov

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                                v3.8.1
==> Detecting CI Provider
    No CI Detected. Using git/mercurial
==> Configuration:
    Endpoint: https://codecov.io
{
  commit: 'c7cbce96795405dc91aebd92389ae69fe1f4f626',
  branch: 'trentm/blocking-behavior',
  package: 'node-v3.8.1'
}
==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
    $ find /Users/trentm/el/apm-nodejs-http-client2 -type f -name '*.gcno'  -exec gcov  {} +
    Failed to run gcov command.
==> Scanning for reports
    + /Users/trentm/el/apm-nodejs-http-client2/coverage.lcov
==> Uploading reports
    Could not determine repo and owner

which is fine, I just don't have codecov.io creds setup.

With node v14 sometimes this:

% npm run coverage

> elastic-apm-http-client@9.6.0 coverage /Users/trentm/el/apm-nodejs-http-client2
> nyc report --reporter=text-lcov > coverage.lcov && codecov

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                                v3.8.1
==> Detecting CI Provider
    No CI Detected. Using git/mercurial
==> Configuration:
    Endpoint: https://codecov.io
{
  commit: 'c7cbce96795405dc91aebd92389ae69fe1f4f626',
  branch: 'trentm/blocking-behavior',
  package: 'node-v3.8.1'
}
==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
    $ find /Users/trentm/el/apm-nodejs-http-client2 -type f -name '*.gcno'  -exec gcov  {} +
    Failed to run gcov command.
==> Scanning for reports
    + /Users/trentm/el/apm-nodejs-http-client2/coverage.lcov
==> Uploading reports
(node:34727) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'startsWith' of undefined
    at Object.getAgent (/Users/trentm/el/apm-nodejs-http-client2/node_modules/teeny-request/build/src/agents.js:30:22)
    at requestToFetchOptions (/Users/trentm/el/apm-nodejs-http-client2/node_modules/teeny-request/build/src/index.js:86:30)
    at teenyRequest (/Users/trentm/el/apm-nodejs-http-client2/node_modules/teeny-request/build/src/index.js:143:14)
    at /Users/trentm/el/apm-nodejs-http-client2/node_modules/codecov/lib/codecov.js:215:9
    at /Users/trentm/el/apm-nodejs-http-client2/node_modules/teeny-request/build/src/index.js:233:13
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:34727) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:34727) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

which is concerning, but doesn't break builds because the exit status is still 0.

However, on node v15 is does exit non-zero:

% npm run coverage

> elastic-apm-http-client@9.6.0 coverage
> nyc report --reporter=text-lcov > coverage.lcov && codecov

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                                v3.8.1
==> Detecting CI Provider
    No CI Detected. Using git/mercurial
==> Configuration:
    Endpoint: https://codecov.io
{
  commit: 'c7cbce96795405dc91aebd92389ae69fe1f4f626',
  branch: 'trentm/blocking-behavior',
  package: 'node-v3.8.1'
}
==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
    $ find /Users/trentm/el/apm-nodejs-http-client2 -type f -name '*.gcno'  -exec gcov  {} +
    Failed to run gcov command.
==> Scanning for reports
    + /Users/trentm/el/apm-nodejs-http-client2/coverage.lcov
==> Uploading reports
/Users/trentm/el/apm-nodejs-http-client2/node_modules/teeny-request/build/src/agents.js:30
    var isHttp = uri.startsWith('http://');
                     ^

TypeError: Cannot read property 'startsWith' of undefined
    at Object.getAgent (/Users/trentm/el/apm-nodejs-http-client2/node_modules/teeny-request/build/src/agents.js:30:22)
    at requestToFetchOptions (/Users/trentm/el/apm-nodejs-http-client2/node_modules/teeny-request/build/src/index.js:86:30)
    at teenyRequest (/Users/trentm/el/apm-nodejs-http-client2/node_modules/teeny-request/build/src/index.js:143:14)
    at /Users/trentm/el/apm-nodejs-http-client2/node_modules/codecov/lib/codecov.js:215:9
    at /Users/trentm/el/apm-nodejs-http-client2/node_modules/teeny-request/build/src/index.js:233:13
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
npm ERR! code 1
npm ERR! path /Users/trentm/el/apm-nodejs-http-client2
npm ERR! command failed
npm ERR! command sh -c nyc report --reporter=text-lcov > coverage.lcov && codecov

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/trentm/.npm/_logs/2021-03-29T17_15_05_970Z-debug.log

Presumably because in node v15 the new default is to throw on unhandled rejections (--unhandled-rejections=throw).

This is codecov/codecov-node#284

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Mar 29, 2021
@trentm
Copy link
Member Author

trentm commented Mar 29, 2021

I'd like to start testing with node v15 (I'm doing so in my PR #144). If this continues to break builds in Jenkins, then I think we should consider disabling or dropping codecov usage.

@trentm trentm changed the title 'npm run coverage' errors 'npm run coverage' errors; breaks checks for node v15 Apr 5, 2021
@trentm trentm linked a pull request Apr 5, 2021 that will close this issue
@trentm trentm closed this as completed Apr 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant