$
This commit is contained in:
28
node_modules/nyc/lib/commands/check-coverage.js
generated
vendored
Normal file
28
node_modules/nyc/lib/commands/check-coverage.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict'
|
||||
|
||||
const NYC = require('../../index.js')
|
||||
const { cliWrapper, suppressEPIPE, setupOptions } = require('./helpers.js')
|
||||
|
||||
exports.command = 'check-coverage'
|
||||
|
||||
exports.describe = 'check whether coverage is within thresholds provided'
|
||||
|
||||
exports.builder = function (yargs) {
|
||||
yargs
|
||||
.demandCommand(0, 0)
|
||||
.example('$0 check-coverage --lines 95', "check whether the JSON in nyc's output folder meets the thresholds provided")
|
||||
|
||||
setupOptions(yargs, 'check-coverage')
|
||||
}
|
||||
|
||||
exports.handler = cliWrapper(async argv => {
|
||||
process.env.NYC_CWD = process.cwd()
|
||||
|
||||
const nyc = new NYC(argv)
|
||||
await nyc.checkCoverage({
|
||||
lines: argv.lines,
|
||||
functions: argv.functions,
|
||||
branches: argv.branches,
|
||||
statements: argv.statements
|
||||
}, argv['per-file']).catch(suppressEPIPE)
|
||||
})
|
74
node_modules/nyc/lib/commands/helpers.js
generated
vendored
Normal file
74
node_modules/nyc/lib/commands/helpers.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
'use strict'
|
||||
|
||||
const decamelize = require('decamelize')
|
||||
const schema = require('@istanbuljs/schema')
|
||||
|
||||
/* These options still need to be connected to the instrumenter
|
||||
* Disabling them for now also avoids the issue with OSX cutting
|
||||
* off the error help screen at 8192 characters.
|
||||
*/
|
||||
const blockOptions = [
|
||||
'coverageVariable',
|
||||
'coverageGlobalScope',
|
||||
'coverageGlobalScopeFunc'
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
setupOptions (yargs, command, cwd) {
|
||||
Object.entries(schema.nyc.properties).forEach(([name, setup]) => {
|
||||
if (blockOptions.includes(name)) {
|
||||
return
|
||||
}
|
||||
|
||||
const option = {
|
||||
description: setup.description,
|
||||
default: setup.default,
|
||||
type: setup.type
|
||||
}
|
||||
|
||||
if (name === 'cwd') {
|
||||
if (command !== null) {
|
||||
return
|
||||
}
|
||||
|
||||
option.default = cwd
|
||||
option.global = true
|
||||
}
|
||||
|
||||
if (option.type === 'array') {
|
||||
option.type = 'string'
|
||||
}
|
||||
|
||||
if ('nycAlias' in setup) {
|
||||
option.alias = setup.nycAlias
|
||||
}
|
||||
|
||||
const optionName = decamelize(name, '-')
|
||||
yargs.option(optionName, option)
|
||||
if (!setup.nycCommands.includes(command)) {
|
||||
yargs.hide(optionName)
|
||||
}
|
||||
})
|
||||
},
|
||||
/* istanbul ignore next: unsure how to test this */
|
||||
suppressEPIPE (error) {
|
||||
/* Prevent dumping error when `nyc npm t|head` causes stdout to
|
||||
* be closed when reporting runs. */
|
||||
if (error.code !== 'EPIPE') {
|
||||
throw error
|
||||
}
|
||||
},
|
||||
cliWrapper (execute) {
|
||||
return argv => {
|
||||
execute(argv).catch(error => {
|
||||
try {
|
||||
console.error(error.message)
|
||||
} catch (_) {
|
||||
/* We need to run process.exit(1) even if stderr is destroyed */
|
||||
}
|
||||
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
63
node_modules/nyc/lib/commands/instrument.js
generated
vendored
Normal file
63
node_modules/nyc/lib/commands/instrument.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
'use strict'
|
||||
|
||||
const NYC = require('../../index.js')
|
||||
const path = require('path')
|
||||
const { promisify } = require('util')
|
||||
const resolveFrom = require('resolve-from')
|
||||
const rimraf = promisify(require('rimraf'))
|
||||
const { cliWrapper, setupOptions } = require('./helpers.js')
|
||||
|
||||
exports.command = 'instrument <input> [output]'
|
||||
|
||||
exports.describe = 'instruments a file or a directory tree and writes the instrumented code to the desired output location'
|
||||
|
||||
exports.builder = function (yargs) {
|
||||
yargs
|
||||
.demandCommand(0, 0)
|
||||
.example('$0 instrument ./lib ./output', 'instrument all .js files in ./lib with coverage and output in ./output')
|
||||
|
||||
setupOptions(yargs, 'instrument')
|
||||
}
|
||||
|
||||
exports.handler = cliWrapper(async argv => {
|
||||
if (argv.output && !argv.inPlace && (path.resolve(argv.cwd, argv.input) === path.resolve(argv.cwd, argv.output))) {
|
||||
throw new Error('cannot instrument files in place, <input> must differ from <output>. Set \'--in-place\' to force')
|
||||
}
|
||||
|
||||
if (path.relative(argv.cwd, path.resolve(argv.cwd, argv.input)).startsWith('..')) {
|
||||
throw new Error('cannot instrument files outside project root directory')
|
||||
}
|
||||
|
||||
if (argv.delete && argv.inPlace) {
|
||||
throw new Error('cannot use \'--delete\' when instrumenting files in place')
|
||||
}
|
||||
|
||||
if (argv.delete && argv.output && argv.output.length !== 0) {
|
||||
const relPath = path.relative(process.cwd(), path.resolve(argv.output))
|
||||
if (relPath !== '' && !relPath.startsWith('..')) {
|
||||
await rimraf(argv.output)
|
||||
} else {
|
||||
throw new Error(`attempt to delete '${process.cwd()}' or containing directory.`)
|
||||
}
|
||||
}
|
||||
|
||||
// If instrument is set to false enable a noop instrumenter.
|
||||
argv.instrumenter = (argv.instrument)
|
||||
? './lib/instrumenters/istanbul'
|
||||
: './lib/instrumenters/noop'
|
||||
|
||||
if (argv.inPlace) {
|
||||
argv.output = argv.input
|
||||
argv.completeCopy = false
|
||||
}
|
||||
|
||||
const nyc = new NYC(argv)
|
||||
if (!argv.useSpawnWrap) {
|
||||
nyc.require.forEach(requireModule => {
|
||||
const mod = resolveFrom.silent(nyc.cwd, requireModule) || requireModule
|
||||
require(mod)
|
||||
})
|
||||
}
|
||||
|
||||
await nyc.instrumentAllFiles(argv.input, argv.output)
|
||||
})
|
46
node_modules/nyc/lib/commands/merge.js
generated
vendored
Normal file
46
node_modules/nyc/lib/commands/merge.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const makeDir = require('make-dir')
|
||||
const fs = require('../fs-promises')
|
||||
const { cliWrapper, setupOptions } = require('./helpers.js')
|
||||
|
||||
const NYC = require('../../index.js')
|
||||
|
||||
exports.command = 'merge <input-directory> [output-file]'
|
||||
|
||||
exports.describe = 'merge istanbul format coverage output in a given folder'
|
||||
|
||||
exports.builder = function (yargs) {
|
||||
yargs
|
||||
.demandCommand(0, 0)
|
||||
.example('$0 merge ./out coverage.json', 'merge together reports in ./out and output as coverage.json')
|
||||
.positional('input-directory', {
|
||||
describe: 'directory containing multiple istanbul coverage files',
|
||||
type: 'text',
|
||||
default: './.nyc_output'
|
||||
})
|
||||
.positional('output-file', {
|
||||
describe: 'file to output combined istanbul format coverage to',
|
||||
type: 'text',
|
||||
default: 'coverage.json'
|
||||
})
|
||||
|
||||
setupOptions(yargs, 'merge')
|
||||
yargs.default('exclude-after-remap', false)
|
||||
}
|
||||
|
||||
exports.handler = cliWrapper(async argv => {
|
||||
process.env.NYC_CWD = process.cwd()
|
||||
const nyc = new NYC(argv)
|
||||
const inputStat = await fs.stat(argv.inputDirectory).catch(error => {
|
||||
throw new Error(`failed access input directory ${argv.inputDirectory} with error:\n\n${error.message}`)
|
||||
})
|
||||
|
||||
if (!inputStat.isDirectory()) {
|
||||
throw new Error(`${argv.inputDirectory} was not a directory`)
|
||||
}
|
||||
await makeDir(path.dirname(argv.outputFile))
|
||||
const map = await nyc.getCoverageMapFromAllCoverageFiles(argv.inputDirectory)
|
||||
await fs.writeFile(argv.outputFile, JSON.stringify(map, null, 2), 'utf8')
|
||||
console.info(`coverage files in ${argv.inputDirectory} merged into ${argv.outputFile}`)
|
||||
})
|
30
node_modules/nyc/lib/commands/report.js
generated
vendored
Normal file
30
node_modules/nyc/lib/commands/report.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict'
|
||||
|
||||
const NYC = require('../../index.js')
|
||||
const { cliWrapper, suppressEPIPE, setupOptions } = require('./helpers.js')
|
||||
|
||||
exports.command = 'report'
|
||||
|
||||
exports.describe = 'run coverage report for .nyc_output'
|
||||
|
||||
exports.builder = function (yargs) {
|
||||
yargs
|
||||
.demandCommand(0, 0)
|
||||
.example('$0 report --reporter=lcov', 'output an HTML lcov report to ./coverage')
|
||||
|
||||
setupOptions(yargs, 'report')
|
||||
}
|
||||
|
||||
exports.handler = cliWrapper(async argv => {
|
||||
process.env.NYC_CWD = process.cwd()
|
||||
var nyc = new NYC(argv)
|
||||
await nyc.report().catch(suppressEPIPE)
|
||||
if (argv.checkCoverage) {
|
||||
await nyc.checkCoverage({
|
||||
lines: argv.lines,
|
||||
functions: argv.functions,
|
||||
branches: argv.branches,
|
||||
statements: argv.statements
|
||||
}, argv['per-file']).catch(suppressEPIPE)
|
||||
}
|
||||
})
|
65
node_modules/nyc/lib/config-util.js
generated
vendored
Normal file
65
node_modules/nyc/lib/config-util.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const findUp = require('find-up')
|
||||
const Yargs = require('yargs/yargs')
|
||||
|
||||
const { setupOptions } = require('./commands/helpers')
|
||||
const processArgs = require('./process-args')
|
||||
const { loadNycConfig } = require('@istanbuljs/load-nyc-config')
|
||||
|
||||
async function guessCWD (cwd) {
|
||||
cwd = cwd || process.env.NYC_CWD || process.cwd()
|
||||
const pkgPath = await findUp('package.json', { cwd })
|
||||
if (pkgPath) {
|
||||
cwd = path.dirname(pkgPath)
|
||||
}
|
||||
|
||||
return cwd
|
||||
}
|
||||
|
||||
async function processConfig (cwd) {
|
||||
cwd = await guessCWD(cwd)
|
||||
const yargs = Yargs([])
|
||||
.usage('$0 [command] [options]')
|
||||
.usage('$0 [options] [bin-to-instrument]')
|
||||
.showHidden(false)
|
||||
|
||||
setupOptions(yargs, null, cwd)
|
||||
|
||||
yargs
|
||||
.example('$0 npm test', 'instrument your tests with coverage')
|
||||
.example('$0 --require @babel/register npm test', 'instrument your tests with coverage and transpile with Babel')
|
||||
.example('$0 report --reporter=text-lcov', 'output lcov report after running your tests')
|
||||
.epilog('visit https://git.io/vHysA for list of available reporters')
|
||||
.boolean('h')
|
||||
.boolean('version')
|
||||
.help(false)
|
||||
.version(false)
|
||||
|
||||
const instrumenterArgs = processArgs.hideInstrumenteeArgs()
|
||||
|
||||
// This yargs.parse must come before any options that exit post-hoc
|
||||
const childArgs = processArgs.hideInstrumenterArgs(yargs.parse(process.argv.slice(2)))
|
||||
const config = await loadNycConfig(yargs.parse(instrumenterArgs))
|
||||
|
||||
yargs
|
||||
.config(config)
|
||||
.help('h')
|
||||
.alias('h', 'help')
|
||||
.version()
|
||||
.command(require('./commands/check-coverage'))
|
||||
.command(require('./commands/instrument'))
|
||||
.command(require('./commands/report'))
|
||||
.command(require('./commands/merge'))
|
||||
|
||||
return {
|
||||
get argv () {
|
||||
return yargs.parse(instrumenterArgs)
|
||||
},
|
||||
childArgs,
|
||||
yargs
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = processConfig
|
51
node_modules/nyc/lib/fs-promises.js
generated
vendored
Normal file
51
node_modules/nyc/lib/fs-promises.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
const { promisify } = require('util')
|
||||
|
||||
module.exports = { ...fs }
|
||||
|
||||
// Promisify all functions for consistency
|
||||
const fns = [
|
||||
'access',
|
||||
'appendFile',
|
||||
'chmod',
|
||||
'chown',
|
||||
'close',
|
||||
'copyFile',
|
||||
'fchmod',
|
||||
'fchown',
|
||||
'fdatasync',
|
||||
'fstat',
|
||||
'fsync',
|
||||
'ftruncate',
|
||||
'futimes',
|
||||
'lchmod',
|
||||
'lchown',
|
||||
'link',
|
||||
'lstat',
|
||||
'mkdir',
|
||||
'mkdtemp',
|
||||
'open',
|
||||
'read',
|
||||
'readdir',
|
||||
'readFile',
|
||||
'readlink',
|
||||
'realpath',
|
||||
'rename',
|
||||
'rmdir',
|
||||
'stat',
|
||||
'symlink',
|
||||
'truncate',
|
||||
'unlink',
|
||||
'utimes',
|
||||
'write',
|
||||
'writeFile'
|
||||
]
|
||||
fns.forEach(fn => {
|
||||
/* istanbul ignore else: all functions exist on OSX */
|
||||
if (fs[fn]) {
|
||||
module.exports[fn] = promisify(fs[fn])
|
||||
}
|
||||
})
|
30
node_modules/nyc/lib/hash.js
generated
vendored
Normal file
30
node_modules/nyc/lib/hash.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict'
|
||||
|
||||
function getInvalidatingOptions (config) {
|
||||
return [
|
||||
'compact',
|
||||
'esModules',
|
||||
'ignoreClassMethods',
|
||||
'instrument',
|
||||
'instrumenter',
|
||||
'parserPlugins',
|
||||
'preserveComments',
|
||||
'produceSourceMap',
|
||||
'sourceMap'
|
||||
].reduce((acc, optName) => {
|
||||
acc[optName] = config[optName]
|
||||
return acc
|
||||
}, {})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
salt (config) {
|
||||
return JSON.stringify({
|
||||
modules: {
|
||||
'istanbul-lib-instrument': require('istanbul-lib-instrument/package.json').version,
|
||||
nyc: require('../package.json').version
|
||||
},
|
||||
nycrc: getInvalidatingOptions(config)
|
||||
})
|
||||
}
|
||||
}
|
44
node_modules/nyc/lib/instrumenters/istanbul.js
generated
vendored
Normal file
44
node_modules/nyc/lib/instrumenters/istanbul.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict'
|
||||
|
||||
function InstrumenterIstanbul (options) {
|
||||
const { createInstrumenter } = require('istanbul-lib-instrument')
|
||||
const convertSourceMap = require('convert-source-map')
|
||||
|
||||
const instrumenter = createInstrumenter({
|
||||
autoWrap: true,
|
||||
coverageVariable: '__coverage__',
|
||||
embedSource: true,
|
||||
compact: options.compact,
|
||||
preserveComments: options.preserveComments,
|
||||
produceSourceMap: options.produceSourceMap,
|
||||
ignoreClassMethods: options.ignoreClassMethods,
|
||||
esModules: options.esModules,
|
||||
parserPlugins: options.parserPlugins
|
||||
})
|
||||
|
||||
return {
|
||||
instrumentSync (code, filename, { sourceMap, registerMap }) {
|
||||
var instrumented = instrumenter.instrumentSync(code, filename, sourceMap)
|
||||
if (instrumented !== code) {
|
||||
registerMap()
|
||||
}
|
||||
|
||||
// the instrumenter can optionally produce source maps,
|
||||
// this is useful for features like remapping stack-traces.
|
||||
if (options.produceSourceMap) {
|
||||
var lastSourceMap = instrumenter.lastSourceMap()
|
||||
/* istanbul ignore else */
|
||||
if (lastSourceMap) {
|
||||
instrumented += '\n' + convertSourceMap.fromObject(lastSourceMap).toComment()
|
||||
}
|
||||
}
|
||||
|
||||
return instrumented
|
||||
},
|
||||
lastFileCoverage () {
|
||||
return instrumenter.lastFileCoverage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InstrumenterIstanbul
|
22
node_modules/nyc/lib/instrumenters/noop.js
generated
vendored
Normal file
22
node_modules/nyc/lib/instrumenters/noop.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
function NOOP () {
|
||||
const { readInitialCoverage } = require('istanbul-lib-instrument')
|
||||
|
||||
return {
|
||||
instrumentSync (code, filename) {
|
||||
const extracted = readInitialCoverage(code)
|
||||
if (extracted) {
|
||||
this.fileCoverage = extracted.coverageData
|
||||
} else {
|
||||
this.fileCoverage = null
|
||||
}
|
||||
return code
|
||||
},
|
||||
lastFileCoverage () {
|
||||
return this.fileCoverage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NOOP
|
39
node_modules/nyc/lib/process-args.js
generated
vendored
Normal file
39
node_modules/nyc/lib/process-args.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict'
|
||||
|
||||
const { Parser } = require('yargs/yargs')
|
||||
const commands = [
|
||||
'report',
|
||||
'check-coverage',
|
||||
'instrument',
|
||||
'merge'
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
// don't pass arguments that are meant
|
||||
// for nyc to the bin being instrumented.
|
||||
hideInstrumenterArgs: function (yargv) {
|
||||
var argv = process.argv.slice(1)
|
||||
argv = argv.slice(argv.indexOf(yargv._[0]))
|
||||
if (argv[0][0] === '-') {
|
||||
argv.unshift(process.execPath)
|
||||
}
|
||||
return argv
|
||||
},
|
||||
// don't pass arguments for the bin being
|
||||
// instrumented to nyc.
|
||||
hideInstrumenteeArgs: function () {
|
||||
var argv = process.argv.slice(2)
|
||||
var yargv = Parser(argv)
|
||||
if (!yargv._.length) return argv
|
||||
for (var i = 0, command; (command = yargv._[i]) !== undefined; i++) {
|
||||
if (~commands.indexOf(command)) return argv
|
||||
}
|
||||
|
||||
// drop all the arguments after the bin being
|
||||
// instrumented by nyc.
|
||||
argv = argv.slice(0, argv.indexOf(yargv._[0]))
|
||||
argv.push(yargv._[0])
|
||||
|
||||
return argv
|
||||
}
|
||||
}
|
27
node_modules/nyc/lib/register-env.js
generated
vendored
Normal file
27
node_modules/nyc/lib/register-env.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict'
|
||||
|
||||
const processOnSpawn = require('process-on-spawn')
|
||||
|
||||
const envToCopy = {}
|
||||
|
||||
processOnSpawn.addListener(({ env }) => {
|
||||
Object.assign(env, envToCopy)
|
||||
})
|
||||
|
||||
const copyAtLoad = [
|
||||
'NYC_CONFIG',
|
||||
'NYC_CWD',
|
||||
'NYC_PROCESS_ID',
|
||||
'BABEL_DISABLE_CACHE',
|
||||
'NYC_PROCESS_ID'
|
||||
]
|
||||
|
||||
for (const env of copyAtLoad) {
|
||||
if (env in process.env) {
|
||||
envToCopy[env] = process.env[env]
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function updateVariable (envName) {
|
||||
envToCopy[envName] = process.env[envName]
|
||||
}
|
84
node_modules/nyc/lib/source-maps.js
generated
vendored
Normal file
84
node_modules/nyc/lib/source-maps.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
'use strict'
|
||||
|
||||
const convertSourceMap = require('convert-source-map')
|
||||
const libCoverage = require('istanbul-lib-coverage')
|
||||
const libSourceMaps = require('istanbul-lib-source-maps')
|
||||
const fs = require('./fs-promises')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const pMap = require('p-map')
|
||||
|
||||
class SourceMaps {
|
||||
constructor (opts) {
|
||||
this.cache = opts.cache
|
||||
this.cacheDirectory = opts.cacheDirectory
|
||||
this.loadedMaps = {}
|
||||
this._sourceMapCache = libSourceMaps.createSourceMapStore()
|
||||
}
|
||||
|
||||
cachedPath (source, hash) {
|
||||
return path.join(
|
||||
this.cacheDirectory,
|
||||
`${path.parse(source).name}-${hash}.map`
|
||||
)
|
||||
}
|
||||
|
||||
purgeCache () {
|
||||
this._sourceMapCache = libSourceMaps.createSourceMapStore()
|
||||
this.loadedMaps = {}
|
||||
}
|
||||
|
||||
extract (code, filename) {
|
||||
const sourceMap = convertSourceMap.fromSource(code) || convertSourceMap.fromMapFileSource(code, path.dirname(filename))
|
||||
return sourceMap ? sourceMap.toObject() : undefined
|
||||
}
|
||||
|
||||
registerMap (filename, hash, sourceMap) {
|
||||
if (!sourceMap) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.cache && hash) {
|
||||
const mapPath = this.cachedPath(filename, hash)
|
||||
fs.writeFileSync(mapPath, JSON.stringify(sourceMap))
|
||||
} else {
|
||||
this._sourceMapCache.registerMap(filename, sourceMap)
|
||||
}
|
||||
}
|
||||
|
||||
async remapCoverage (obj) {
|
||||
const transformed = await this._sourceMapCache.transformCoverage(
|
||||
libCoverage.createCoverageMap(obj)
|
||||
)
|
||||
return transformed.data
|
||||
}
|
||||
|
||||
async reloadCachedSourceMaps (report) {
|
||||
await pMap(
|
||||
Object.entries(report),
|
||||
async ([absFile, fileReport]) => {
|
||||
if (!fileReport || !fileReport.contentHash) {
|
||||
return
|
||||
}
|
||||
|
||||
const hash = fileReport.contentHash
|
||||
if (!(hash in this.loadedMaps)) {
|
||||
try {
|
||||
const mapPath = this.cachedPath(absFile, hash)
|
||||
this.loadedMaps[hash] = JSON.parse(await fs.readFile(mapPath, 'utf8'))
|
||||
} catch (e) {
|
||||
// set to false to avoid repeatedly trying to load the map
|
||||
this.loadedMaps[hash] = false
|
||||
}
|
||||
}
|
||||
|
||||
if (this.loadedMaps[hash]) {
|
||||
this._sourceMapCache.registerMap(absFile, this.loadedMaps[hash])
|
||||
}
|
||||
},
|
||||
{ concurrency: os.cpus().length }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SourceMaps
|
28
node_modules/nyc/lib/wrap.js
generated
vendored
Normal file
28
node_modules/nyc/lib/wrap.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict'
|
||||
|
||||
const NYC = require('../index.js')
|
||||
|
||||
const config = JSON.parse(
|
||||
process.env.NYC_CONFIG ||
|
||||
/* istanbul ignore next */ '{}'
|
||||
)
|
||||
|
||||
config.isChildProcess = true
|
||||
|
||||
config._processInfo = {
|
||||
pid: process.pid,
|
||||
ppid: process.ppid,
|
||||
parent: process.env.NYC_PROCESS_ID || null
|
||||
}
|
||||
|
||||
if (process.env.NYC_PROCESSINFO_EXTERNAL_ID) {
|
||||
config._processInfo.externalId = process.env.NYC_PROCESSINFO_EXTERNAL_ID
|
||||
delete process.env.NYC_PROCESSINFO_EXTERNAL_ID
|
||||
}
|
||||
|
||||
if (process.env.NYC_CONFIG_OVERRIDE) {
|
||||
Object.assign(config, JSON.parse(process.env.NYC_CONFIG_OVERRIDE))
|
||||
process.env.NYC_CONFIG = JSON.stringify(config)
|
||||
}
|
||||
|
||||
;(new NYC(config)).wrap()
|
Reference in New Issue
Block a user