diff --git a/lib/chromium.js b/lib/chromium.js index 1a0f3a26..b388442f 100644 --- a/lib/chromium.js +++ b/lib/chromium.js @@ -126,19 +126,19 @@ module.exports = function (b, opts) { return; } if (text.indexOf('[COVERAGE ') === 0) { - if (process.env.NYC_ROOT_ID) { - var nycConfig = JSON.parse(process.env.NYC_CONFIG); - var json = text.substring(10, text.length - 1); - var file = path.join(nycConfig.tempDir, - process.env.NYC_ROOT_ID + '.json'); - fs.writeFile(file, json, 'utf8', function (err) { - if (err) { - b.emit('error', err); - } - }); - return; + var nycRootID = process.env.NYC_ROOT_ID; + if (!nycRootID) { + // NYC >v15 does not export a NYC_ROOT_ID so use a "random" uuid instead + nycRootID = '4638ceac-c8d9-411d-9e1f-72755846a221'; } - output.write('Coverage information received, but no nyc\n'); + var nycConfig = JSON.parse(process.env.NYC_CONFIG); + var json = text.substring(10, text.length - 1); + var file = path.join(nycConfig.tempDir, nycRootID + '.json'); + fs.writeFile(file, json, 'utf8', function (err) { + if (err) { + b.emit('error', err); + } + }); return; } if (text.indexOf('[EXIT ') === 0) {