From df113880c77d281d30a63393b9abb4045e17f811 Mon Sep 17 00:00:00 2001 From: Nikita Golov Date: Thu, 7 Mar 2019 10:56:27 +0300 Subject: [PATCH 1/4] Fix the ability to lookup source (#837) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 743ef1136..166584c54 100755 --- a/index.js +++ b/index.js @@ -212,7 +212,7 @@ NYC.prototype.instrumentAllFiles = function (input, output, cb) { } if (transform) { - code = transform(code, { filename: filename, relFile: inFile }) + code = transform(code, {filename: path.resolve(inputDir, filename), relFile: inFile}) } if (!output) { From cebef6af7ad6d70fae714a9ea64f482812a26274 Mon Sep 17 00:00:00 2001 From: Nikita Golov Date: Thu, 7 Mar 2019 10:58:20 +0300 Subject: [PATCH 2/4] Fix the ability to lookup source (#837) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 166584c54..fae4aa24a 100755 --- a/index.js +++ b/index.js @@ -212,7 +212,7 @@ NYC.prototype.instrumentAllFiles = function (input, output, cb) { } if (transform) { - code = transform(code, {filename: path.resolve(inputDir, filename), relFile: inFile}) + code = transform(code, { filename: path.resolve(inputDir, filename), relFile: inFile }) } if (!output) { From 0ee30a1e60c340bf4b07233a1176b32161213621 Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Thu, 7 Mar 2019 12:15:39 -0500 Subject: [PATCH 3/4] Update tests, use existing variable for resolved filename. --- index.js | 2 +- test/nyc-integration.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index fae4aa24a..80198b2c3 100755 --- a/index.js +++ b/index.js @@ -212,7 +212,7 @@ NYC.prototype.instrumentAllFiles = function (input, output, cb) { } if (transform) { - code = transform(code, { filename: path.resolve(inputDir, filename), relFile: inFile }) + code = transform(code, { filename: inFile, relFile: inFile }) } if (!output) { diff --git a/test/nyc-integration.js b/test/nyc-integration.js index 7c208230c..9f71e14f2 100644 --- a/test/nyc-integration.js +++ b/test/nyc-integration.js @@ -480,7 +480,7 @@ describe('the nyc cli', function () { proc.on('close', function (code) { code.should.equal(0) - stdout.should.match(/path:"\.\/half-covered\.js"/) + stdout.should.contain(`path:"${path.resolve(fixturesCLI, 'half-covered.js')}"`) done() }) }) From b535b3793f7539444c5e3901c11fa1fd770abd72 Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Thu, 7 Mar 2019 12:38:05 -0500 Subject: [PATCH 4/4] Fix Windows testing. --- test/nyc-integration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/nyc-integration.js b/test/nyc-integration.js index 9f71e14f2..9cc5cfe8b 100644 --- a/test/nyc-integration.js +++ b/test/nyc-integration.js @@ -480,7 +480,7 @@ describe('the nyc cli', function () { proc.on('close', function (code) { code.should.equal(0) - stdout.should.contain(`path:"${path.resolve(fixturesCLI, 'half-covered.js')}"`) + stdout.should.contain(`path:${JSON.stringify(path.resolve(fixturesCLI, 'half-covered.js'))}`) done() }) })