Skip to content
Permalink
Browse files

coverage: pass cwd to path.resolve() in setup

During coverage setup, path.resolve() is called.
path.resolve() can potentially call process.cwd(), which
hasn't been bootstrapped yet. This commit passes the
current working directory directly so that path.resolve()
doesn't attempt to compute it.

PR-URL: #25289
Fixes: #25287
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

Backport-PR-URL: #25496
  • Loading branch information...
cjihrig authored and addaleax committed Dec 31, 2018
1 parent daca318 commit 63fbd008344f5db14bf32a4348e0bd20609fc359
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/internal/process/coverage.js
@@ -76,9 +76,10 @@ function setup() {
}));

try {
const { cwd } = internalBinding('process_methods');
const { resolve } = require('path');
coverageDirectory = process.env.NODE_V8_COVERAGE =
resolve(process.env.NODE_V8_COVERAGE);
resolve(cwd(), process.env.NODE_V8_COVERAGE);
} catch (err) {
process._rawDebug(err.toString());
}

0 comments on commit 63fbd00

Please sign in to comment.
You can’t perform that action at this time.