forked from enviPath/enviPy
Current Dev State
This commit is contained in:
14
static/js/ketcher2/node_modules/tap/bin/mochatap.js
generated
vendored
Executable file
14
static/js/ketcher2/node_modules/tap/bin/mochatap.js
generated
vendored
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env node
|
||||
var tap = require('../lib/tap.js')
|
||||
var args = process.argv.slice(2)
|
||||
|
||||
if (args.length === 1) {
|
||||
var path = require('path')
|
||||
var file = path.resolve(args[0])
|
||||
tap.mochaGlobals()
|
||||
require(file)
|
||||
} else {
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
tap.spawn(process.execPath, [__filename, args[i]])
|
||||
}
|
||||
}
|
||||
809
static/js/ketcher2/node_modules/tap/bin/run.js
generated
vendored
Executable file
809
static/js/ketcher2/node_modules/tap/bin/run.js
generated
vendored
Executable file
@ -0,0 +1,809 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var node = process.execPath
|
||||
var fs = require('fs')
|
||||
var spawn = require('child_process').spawn
|
||||
var fg = require('foreground-child')
|
||||
var opener = require('opener')
|
||||
var colorSupport = require('color-support')
|
||||
var nycBin = require.resolve('nyc/bin/nyc.js')
|
||||
var glob = require('glob')
|
||||
var isexe = require('isexe')
|
||||
var osHomedir = require('os-homedir')
|
||||
var yaml = require('js-yaml')
|
||||
var path = require('path')
|
||||
var exists = require('fs-exists-cached').sync
|
||||
var os = require('os');
|
||||
|
||||
var coverageServiceTest = process.env.COVERAGE_SERVICE_TEST === 'true'
|
||||
|
||||
// NYC will not wrap a module in node_modules.
|
||||
// So, we need to tell the child proc when it's been added.
|
||||
if (process.env._TAP_COVERAGE_ === '1')
|
||||
global.__coverage__ = global.__coverage__ || {}
|
||||
|
||||
// console.error(process.argv.join(' '))
|
||||
// console.error('CST=%j', process.env.COVERAGE_SERVICE_TEST)
|
||||
// console.error('CRT=%j', process.env.COVERALLS_REPO_TOKEN)
|
||||
if (coverageServiceTest)
|
||||
console.log('COVERAGE_SERVICE_TEST')
|
||||
|
||||
// Add new coverage services here.
|
||||
// it'll check for the environ named and pipe appropriately.
|
||||
//
|
||||
// Currently only Coveralls is supported, but the infrastructure
|
||||
// is left in place in case some noble soul fixes the codecov
|
||||
// module in the future. See https://github.com/tapjs/node-tap/issues/270
|
||||
var coverageServices = [
|
||||
{
|
||||
env: 'COVERALLS_REPO_TOKEN',
|
||||
bin: require.resolve('coveralls/bin/coveralls.js'),
|
||||
name: 'Coveralls'
|
||||
}
|
||||
]
|
||||
|
||||
main()
|
||||
|
||||
function main () {
|
||||
var args = process.argv.slice(2)
|
||||
|
||||
if (!args.length && process.stdin.isTTY) {
|
||||
console.error(usage())
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// set default args
|
||||
var defaults = constructDefaultArgs()
|
||||
|
||||
// parse dotfile
|
||||
var rcFile = process.env.TAP_RCFILE || (osHomedir() + '/.taprc')
|
||||
var rcOptions = parseRcFile(rcFile)
|
||||
|
||||
// supplement defaults with parsed rc options
|
||||
if (rcOptions)
|
||||
Object.keys(rcOptions).forEach(function (k) {
|
||||
defaults[k] = rcOptions[k]
|
||||
})
|
||||
|
||||
defaults.rcFile = rcFile
|
||||
|
||||
// parse args
|
||||
var options = parseArgs(args, defaults)
|
||||
|
||||
if (!options)
|
||||
return
|
||||
|
||||
process.stdout.on('error', function (er) {
|
||||
if (er.code === 'EPIPE')
|
||||
process.exit()
|
||||
else
|
||||
throw er
|
||||
})
|
||||
|
||||
options.files = globFiles(options.files)
|
||||
|
||||
if ((options.coverageReport || options.checkCoverage) &&
|
||||
options.files.length === 0)
|
||||
return runCoverageReport(options)
|
||||
|
||||
if (options.files.length === 0) {
|
||||
console.error('Reading TAP data from stdin (use "-" argument to suppress)')
|
||||
options.files.push('-')
|
||||
}
|
||||
|
||||
if (options.files.length === 1 && options.files[0] === '-') {
|
||||
if (options.coverage)
|
||||
console.error('Coverage disabled because stdin cannot be instrumented')
|
||||
stdinOnly(options)
|
||||
return
|
||||
}
|
||||
|
||||
// By definition, the next block cannot be covered, because
|
||||
// they are only relevant when coverage is turned off.
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (options.coverage && !global.__coverage__)
|
||||
return respawnWithCoverage(options)
|
||||
|
||||
setupTapEnv(options)
|
||||
|
||||
runTests(options)
|
||||
}
|
||||
|
||||
function constructDefaultArgs () {
|
||||
var defaultTimeout = 30
|
||||
if (global.__coverage__)
|
||||
defaultTimeout = 240
|
||||
|
||||
var defaultArgs = {
|
||||
nodeArgs: [],
|
||||
nycArgs: [],
|
||||
testArgs: [],
|
||||
timeout: +process.env.TAP_TIMEOUT || defaultTimeout,
|
||||
color: !!colorSupport.level,
|
||||
reporter: null,
|
||||
files: [],
|
||||
grep: [],
|
||||
grepInvert: false,
|
||||
bail: false,
|
||||
saveFile: null,
|
||||
pipeToService: false,
|
||||
coverageReport: null,
|
||||
browser: true,
|
||||
coverage: undefined,
|
||||
checkCoverage: false,
|
||||
branches: 0,
|
||||
functions: 0,
|
||||
lines: 0,
|
||||
statements: 0,
|
||||
jobs: 1,
|
||||
outputFile: null
|
||||
}
|
||||
|
||||
if (process.env.TAP_COLORS !== undefined)
|
||||
defaultArgs.color = !!(+process.env.TAP_COLORS)
|
||||
|
||||
return defaultArgs
|
||||
}
|
||||
|
||||
function parseArgs (args, defaults) {
|
||||
var options = defaults || {}
|
||||
|
||||
var singleFlags = {
|
||||
b: 'bail',
|
||||
B: 'no-bail',
|
||||
i: 'invert',
|
||||
I: 'no-invert',
|
||||
c: 'color',
|
||||
C: 'no-color',
|
||||
T: 'no-timeout',
|
||||
J: 'jobs-auto',
|
||||
O: 'only',
|
||||
h: 'help',
|
||||
'?': 'help',
|
||||
v: 'version'
|
||||
}
|
||||
|
||||
var singleOpts = {
|
||||
j: 'jobs',
|
||||
g: 'grep',
|
||||
R: 'reporter',
|
||||
t: 'timeout',
|
||||
s: 'save',
|
||||
o: 'output-file'
|
||||
}
|
||||
|
||||
// If we're running under Travis-CI with a Coveralls.io token,
|
||||
// then it's a safe bet that we ought to output coverage.
|
||||
for (var i = 0; i < coverageServices.length && !options.pipeToService; i++) {
|
||||
if (process.env[coverageServices[i].env])
|
||||
options.pipeToService = true
|
||||
}
|
||||
|
||||
var defaultCoverage = options.pipeToService
|
||||
var dumpConfig = false
|
||||
|
||||
for (i = 0; i < args.length; i++) {
|
||||
var arg = args[i]
|
||||
if (arg.charAt(0) !== '-' || arg === '-') {
|
||||
options.files.push(arg)
|
||||
continue
|
||||
}
|
||||
|
||||
// short-flags
|
||||
if (arg.charAt(1) !== '-' && arg !== '-gc') {
|
||||
var expand = []
|
||||
for (var f = 1; f < arg.length; f++) {
|
||||
var fc = arg.charAt(f)
|
||||
var sf = singleFlags[fc]
|
||||
var so = singleOpts[fc]
|
||||
if (sf)
|
||||
expand.push('--' + sf)
|
||||
else if (so) {
|
||||
var soval = arg.slice(f + 1)
|
||||
if (soval.charAt(0) !== '=') {
|
||||
soval = '=' + soval
|
||||
}
|
||||
expand.push('--' + so + soval)
|
||||
f = arg.length
|
||||
} else if (arg !== '-' + fc)
|
||||
expand.push('-' + fc)
|
||||
}
|
||||
if (expand.length) {
|
||||
args.splice.apply(args, [i, 1].concat(expand))
|
||||
i--
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
var key = arg
|
||||
var val = null
|
||||
if (key.match(/^--/) && arg.indexOf('=') !== -1) {
|
||||
var kv = arg.split('=')
|
||||
key = kv.shift()
|
||||
val = kv.join('=')
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case '--help':
|
||||
console.log(usage())
|
||||
return null
|
||||
|
||||
case '--dump-config':
|
||||
dumpConfig = true
|
||||
continue
|
||||
|
||||
case '--nyc-help':
|
||||
nycHelp()
|
||||
return null
|
||||
|
||||
case '--nyc-version':
|
||||
nycVersion()
|
||||
return null
|
||||
|
||||
case '--version':
|
||||
console.log(require('../package.json').version)
|
||||
return null
|
||||
|
||||
case '--jobs':
|
||||
val = val || args[++i]
|
||||
options.jobs = +val
|
||||
continue
|
||||
|
||||
case '--jobs-auto':
|
||||
val = os.cpus().length;
|
||||
options.jobs = +val
|
||||
continue
|
||||
|
||||
case '--coverage-report':
|
||||
options.coverageReport = val || args[++i]
|
||||
if (options.coverageReport === 'html')
|
||||
options.coverageReport = 'lcov'
|
||||
defaultCoverage = true
|
||||
continue
|
||||
|
||||
case '--no-browser':
|
||||
options.browser = false
|
||||
continue
|
||||
|
||||
case '--no-coverage-report':
|
||||
options.coverageReport = false
|
||||
continue
|
||||
|
||||
case '--no-cov': case '--no-coverage':
|
||||
options.coverage = false
|
||||
continue
|
||||
|
||||
case '--cov': case '--coverage':
|
||||
options.coverage = true
|
||||
continue
|
||||
|
||||
case '--save':
|
||||
val = val || args[++i]
|
||||
options.saveFile = val
|
||||
continue
|
||||
|
||||
case '--reporter':
|
||||
val = val || args[++i]
|
||||
options.reporter = val
|
||||
continue
|
||||
|
||||
case '--gc': case '-gc': case '--expose-gc':
|
||||
options.nodeArgs.push('--expose-gc')
|
||||
continue
|
||||
|
||||
case '--strict':
|
||||
options.nodeArgs.push('--use_strict')
|
||||
continue
|
||||
|
||||
case '--debug':
|
||||
options.nodeArgs.push('--debug')
|
||||
continue
|
||||
|
||||
case '--debug-brk':
|
||||
options.nodeArgs.push('--debug-brk')
|
||||
continue
|
||||
|
||||
case '--harmony':
|
||||
options.nodeArgs.push('--harmony')
|
||||
continue
|
||||
|
||||
case '--node-arg':
|
||||
val = val || args[++i]
|
||||
if (val !== undefined)
|
||||
options.nodeArgs.push(val)
|
||||
continue
|
||||
|
||||
case '--check-coverage':
|
||||
defaultCoverage = true
|
||||
options.checkCoverage = true
|
||||
continue
|
||||
|
||||
case '--test-arg':
|
||||
val = val || args[++i]
|
||||
if (val !== undefined)
|
||||
options.testArgs.push(val)
|
||||
continue
|
||||
|
||||
case '--nyc-arg':
|
||||
val = val || args[++i]
|
||||
if (val !== undefined)
|
||||
options.nycArgs.push(val)
|
||||
continue
|
||||
|
||||
case '--100':
|
||||
defaultCoverage = true
|
||||
options.checkCoverage = true
|
||||
options.branches = 100
|
||||
options.functions = 100
|
||||
options.lines = 100
|
||||
options.statements = 100
|
||||
continue
|
||||
|
||||
case '--branches':
|
||||
case '--functions':
|
||||
case '--lines':
|
||||
case '--statements':
|
||||
defaultCoverage = true
|
||||
val = val || args[++i]
|
||||
options.checkCoverage = true
|
||||
options[key.slice(2)] = val
|
||||
continue
|
||||
|
||||
case '--color':
|
||||
options.color = true
|
||||
continue
|
||||
|
||||
case '--no-color':
|
||||
options.color = false
|
||||
continue
|
||||
|
||||
case '--output-file':
|
||||
val = val || args[++i]
|
||||
if (val !== undefined)
|
||||
options.outputFile = val
|
||||
continue
|
||||
|
||||
case '--no-timeout':
|
||||
options.timeout = 0
|
||||
continue
|
||||
|
||||
case '--timeout':
|
||||
val = val || args[++i]
|
||||
options.timeout = +val
|
||||
continue
|
||||
|
||||
case '--invert':
|
||||
options.grepInvert = true
|
||||
continue
|
||||
|
||||
case '--no-invert':
|
||||
options.grepInvert = false
|
||||
continue
|
||||
|
||||
case '--grep':
|
||||
val = val || args[++i]
|
||||
if (val !== undefined)
|
||||
options.grep.push(strToRegExp(val))
|
||||
continue
|
||||
|
||||
case '--bail':
|
||||
options.bail = true
|
||||
continue
|
||||
|
||||
case '--no-bail':
|
||||
options.bail = false
|
||||
continue
|
||||
|
||||
case '--only':
|
||||
options.only = true
|
||||
continue
|
||||
|
||||
case '--':
|
||||
options.files = options.files.concat(args.slice(i + 1))
|
||||
i = args.length
|
||||
continue
|
||||
|
||||
default:
|
||||
throw new Error('Unknown argument: ' + arg)
|
||||
}
|
||||
}
|
||||
|
||||
if (options.coverage === undefined)
|
||||
options.coverage = defaultCoverage
|
||||
|
||||
if (process.env.TAP === '1')
|
||||
options.reporter = 'tap'
|
||||
|
||||
// default to tap for non-tty envs
|
||||
if (!options.reporter)
|
||||
options.reporter = options.color ? 'classic' : 'tap'
|
||||
|
||||
if (dumpConfig)
|
||||
return console.log(JSON.stringify(options, null, 2))
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
function respawnWithCoverage (options) {
|
||||
// console.error('respawn with coverage')
|
||||
// Re-spawn with coverage
|
||||
var args = [nycBin].concat(
|
||||
'--silent',
|
||||
'--cache=true',
|
||||
options.nycArgs,
|
||||
'--',
|
||||
process.execArgv,
|
||||
process.argv.slice(1)
|
||||
)
|
||||
process.env._TAP_COVERAGE_ = '1'
|
||||
var child = fg(node, args)
|
||||
child.removeAllListeners('close')
|
||||
child.on('close', function (code, signal) {
|
||||
runCoverageReport(options, code, signal)
|
||||
})
|
||||
}
|
||||
|
||||
function pipeToCoverageServices (options, child) {
|
||||
// console.error('pipe to services')
|
||||
var piped = false
|
||||
for (var i = 0; i < coverageServices.length; i++) {
|
||||
// console.error('pipe to service?', coverageServices[i].env)
|
||||
if (process.env[coverageServices[i].env]) {
|
||||
pipeToCoverageService(coverageServices[i], options, child)
|
||||
piped = true
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (!piped)
|
||||
throw new Error('unknown service, internal error')
|
||||
}
|
||||
|
||||
function pipeToCoverageService (service, options, child) {
|
||||
// console.error('pipe to service yes', service.env)
|
||||
var bin = service.bin
|
||||
|
||||
if (coverageServiceTest) {
|
||||
// console.error('use fakey test bin')
|
||||
// test scaffolding.
|
||||
// don't actually send stuff to the service
|
||||
bin = require.resolve('../test/fixtures/cat.js')
|
||||
console.log('%s:%s', service.name, process.env[service.env])
|
||||
}
|
||||
|
||||
var ca = spawn(node, [bin], {
|
||||
stdio: [ 'pipe', 1, 2 ]
|
||||
})
|
||||
|
||||
child.stdout.pipe(ca.stdin)
|
||||
|
||||
ca.on('close', function (code, signal) {
|
||||
if (signal)
|
||||
process.kill(process.pid, signal)
|
||||
else if (code)
|
||||
console.log('Error piping coverage to ' + service.name)
|
||||
else
|
||||
console.log('Successfully piped to ' + service.name)
|
||||
})
|
||||
}
|
||||
|
||||
function runCoverageReport (options, code, signal) {
|
||||
if (options.checkCoverage)
|
||||
runCoverageCheck(options, code, signal)
|
||||
else
|
||||
runCoverageReportOnly(options, code, signal)
|
||||
}
|
||||
|
||||
function runCoverageReportOnly (options, code, signal) {
|
||||
if (options.coverageReport === false)
|
||||
return close(code, signal)
|
||||
|
||||
if (!options.coverageReport) {
|
||||
if (options.pipeToService || coverageServiceTest)
|
||||
options.coverageReport = 'text-lcov'
|
||||
else
|
||||
options.coverageReport = 'text'
|
||||
}
|
||||
|
||||
var args = [nycBin, 'report', '--reporter', options.coverageReport]
|
||||
// console.error('run coverage report', args)
|
||||
|
||||
var child
|
||||
// automatically hook into coveralls
|
||||
if (options.coverageReport === 'text-lcov' && options.pipeToService) {
|
||||
// console.error('pipeToService')
|
||||
child = spawn(node, args, { stdio: [ 0, 'pipe', 2 ] })
|
||||
pipeToCoverageServices(options, child)
|
||||
} else {
|
||||
// otherwise just run the reporter
|
||||
child = fg(node, args)
|
||||
if (options.coverageReport === 'lcov' && options.browser)
|
||||
child.on('exit', function () {
|
||||
opener('coverage/lcov-report/index.html')
|
||||
})
|
||||
}
|
||||
|
||||
if (code || signal) {
|
||||
child.removeAllListeners('close')
|
||||
child.on('close', close)
|
||||
}
|
||||
|
||||
function close (c, s) {
|
||||
if (signal || s) {
|
||||
setTimeout(function () {}, 200)
|
||||
return process.kill(process.pid, signal || s)
|
||||
}
|
||||
if (code || c)
|
||||
return process.exit(code || c)
|
||||
}
|
||||
}
|
||||
|
||||
function coverageCheckArgs (options) {
|
||||
var args = []
|
||||
if (options.branches)
|
||||
args.push('--branches', options.branches)
|
||||
if (options.functions)
|
||||
args.push('--functions', options.functions)
|
||||
if (options.lines)
|
||||
args.push('--lines', options.lines)
|
||||
if (options.statements)
|
||||
args.push('--statements', options.statements)
|
||||
|
||||
return args
|
||||
}
|
||||
|
||||
function runCoverageCheck (options, code, signal) {
|
||||
var args = [nycBin, 'check-coverage'].concat(coverageCheckArgs(options))
|
||||
|
||||
var child = fg(node, args)
|
||||
child.removeAllListeners('close')
|
||||
child.on('close', function (c, s) {
|
||||
runCoverageReportOnly(options, code || c, signal || s)
|
||||
})
|
||||
}
|
||||
|
||||
function usage () {
|
||||
return fs.readFileSync(__dirname + '/usage.txt', 'utf8')
|
||||
.split('@@REPORTERS@@')
|
||||
.join(getReporters())
|
||||
}
|
||||
|
||||
function nycHelp () {
|
||||
fg(node, [nycBin, '--help'])
|
||||
}
|
||||
|
||||
function nycVersion () {
|
||||
console.log(require('nyc/package.json').version)
|
||||
}
|
||||
|
||||
function getReporters () {
|
||||
var types = require('tap-mocha-reporter').types
|
||||
types = types.reduce(function (str, t) {
|
||||
var ll = str.split('\n').pop().length + t.length
|
||||
if (ll < 40)
|
||||
return str + ' ' + t
|
||||
else
|
||||
return str + '\n' + t
|
||||
}, '').trim()
|
||||
var ind = ' '
|
||||
return ind + types.split('\n').join('\n' + ind)
|
||||
}
|
||||
|
||||
function setupTapEnv (options) {
|
||||
process.env.TAP_TIMEOUT = options.timeout
|
||||
if (options.color)
|
||||
process.env.TAP_COLORS = 1
|
||||
else
|
||||
process.env.TAP_COLORS = 0
|
||||
|
||||
if (options.bail)
|
||||
process.env.TAP_BAIL = '1'
|
||||
|
||||
if (options.grepInvert)
|
||||
process.env.TAP_GREP_INVERT = '1'
|
||||
|
||||
if (options.grep.length)
|
||||
process.env.TAP_GREP = options.grep.map(function (pattern) {
|
||||
return pattern.toString()
|
||||
}).join('\n')
|
||||
|
||||
if (options.only)
|
||||
process.env.TAP_ONLY = '1'
|
||||
}
|
||||
|
||||
function globFiles (files) {
|
||||
return files.reduce(function (acc, f) {
|
||||
if (f === '-') {
|
||||
acc.push(f)
|
||||
return acc
|
||||
}
|
||||
|
||||
// glob claims patterns MUST not include any '\'s
|
||||
if (!/\\/.test(f))
|
||||
f = glob.sync(f) || f
|
||||
|
||||
return acc.concat(f)
|
||||
}, [])
|
||||
}
|
||||
|
||||
function makeReporter (options) {
|
||||
var TMR = require('tap-mocha-reporter')
|
||||
return new TMR(options.reporter)
|
||||
}
|
||||
|
||||
function stdinOnly (options) {
|
||||
// if we didn't specify any files, then just passthrough
|
||||
// to the reporter, so we don't get '/dev/stdin' in the suite list.
|
||||
// We have to pause() before piping to switch streams2 into old-mode
|
||||
process.stdin.pause()
|
||||
var reporter = makeReporter(options)
|
||||
process.stdin.pipe(reporter)
|
||||
process.stdin.resume()
|
||||
}
|
||||
|
||||
function readSaveFile (options) {
|
||||
if (options.saveFile)
|
||||
try {
|
||||
return fs.readFileSync(options.saveFile, 'utf8').trim().split('\n')
|
||||
} catch (er) {}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
function saveFails (options, tap) {
|
||||
if (!options.saveFile)
|
||||
return
|
||||
|
||||
var fails = []
|
||||
var successes = []
|
||||
tap.on('result', function (res) {
|
||||
// we will continue to re-run todo tests, even though they're
|
||||
// not technically "failures".
|
||||
if (!res.ok && !res.extra.skip)
|
||||
fails.push(res.extra.file)
|
||||
else
|
||||
successes.push(res.extra.file)
|
||||
})
|
||||
|
||||
tap.on('bailout', function (reason) {
|
||||
// add any pending test files to the fails list.
|
||||
fails.push.apply(fails, options.files.filter(function (file) {
|
||||
return successes.indexOf(file) === -1
|
||||
}))
|
||||
save()
|
||||
})
|
||||
|
||||
tap.on('end', save)
|
||||
|
||||
function save () {
|
||||
fails = fails.reduce(function (set, f) {
|
||||
if (set.indexOf(f) === -1)
|
||||
set.push(f)
|
||||
return set
|
||||
}, [])
|
||||
|
||||
if (!fails.length)
|
||||
try {
|
||||
fs.unlinkSync(options.saveFile)
|
||||
} catch (er) {}
|
||||
else
|
||||
try {
|
||||
fs.writeFileSync(options.saveFile, fails.join('\n') + '\n')
|
||||
} catch (er) {}
|
||||
}
|
||||
}
|
||||
|
||||
function filterFiles (files, saved, parallelOk) {
|
||||
return files.filter(function (file) {
|
||||
if (path.basename(file) === 'tap-parallel-ok')
|
||||
parallelOk[path.resolve(path.dirname(file))] = true
|
||||
else if (path.basename(file) === 'tap-parallel-not-ok')
|
||||
parallelOk[path.resolve(path.dirname(file))] = false
|
||||
else
|
||||
return saved === null || saved.indexOf(file) !== -1
|
||||
})
|
||||
}
|
||||
|
||||
function isParallelOk (parallelOk, file) {
|
||||
var dir = path.resolve(path.dirname(file))
|
||||
|
||||
if (dir in parallelOk)
|
||||
return parallelOk[dir]
|
||||
|
||||
if (exists(dir + '/tap-parallel-ok'))
|
||||
return parallelOk[dir] = true
|
||||
|
||||
if (exists(dir + '/tap-parallel-not-ok'))
|
||||
return parallelOk[dir] = false
|
||||
|
||||
if (dir.length >= process.cwd().length)
|
||||
return isParallelOk(parallelOk, dir)
|
||||
}
|
||||
|
||||
function runAllFiles (options, saved, tap) {
|
||||
var doStdin = false
|
||||
var parallelOk = Object.create(null)
|
||||
|
||||
options.files = filterFiles(options.files, saved, parallelOk)
|
||||
|
||||
for (var i = 0; i < options.files.length; i++) {
|
||||
var opt = {}
|
||||
var file = options.files[i]
|
||||
|
||||
// Pick up stdin after all the other files are handled.
|
||||
if (file === '-') {
|
||||
doStdin = true
|
||||
continue
|
||||
}
|
||||
|
||||
var st = fs.statSync(options.files[i])
|
||||
if (options.timeout)
|
||||
opt.timeout = options.timeout * 1000
|
||||
|
||||
opt.file = file
|
||||
if (options.jobs > 1)
|
||||
opt.buffered = isParallelOk(parallelOk, file) !== false
|
||||
|
||||
if (file.match(/\.js$/)) {
|
||||
var args = options.nodeArgs.concat(file).concat(options.testArgs)
|
||||
tap.spawn(node, args, opt, file)
|
||||
} else if (st.isDirectory()) {
|
||||
var dir = filterFiles(fs.readdirSync(file).map(function (f) {
|
||||
return file + '/' + f
|
||||
}), saved, parallelOk)
|
||||
options.files.push.apply(options.files, dir)
|
||||
} else if (isexe.sync(options.files[i]))
|
||||
tap.spawn(options.files[i], options.testArgs, opt, file)
|
||||
}
|
||||
|
||||
if (doStdin)
|
||||
tap.stdin()
|
||||
}
|
||||
|
||||
function runTests (options) {
|
||||
var saved = readSaveFile(options)
|
||||
|
||||
// At this point, we know we need to use the tap root,
|
||||
// because there are 1 or more files to spawn.
|
||||
var tap = require('../lib/tap.js')
|
||||
tap.runOnly = false
|
||||
|
||||
// greps are passed to children, but not the runner itself
|
||||
tap.grep = []
|
||||
tap.jobs = options.jobs
|
||||
tap.patchProcess()
|
||||
|
||||
// if not -Rtap, then output what the user wants.
|
||||
// otherwise just dump to stdout
|
||||
tap.pipe(options.reporter === 'tap' ? process.stdout: makeReporter(options))
|
||||
|
||||
// need to replay the first version line, because the previous
|
||||
// line will have flushed it out to stdout or the reporter already.
|
||||
if (options.outputFile !== null)
|
||||
tap.pipe(fs.createWriteStream(options.outputFile)).write('TAP version 13\n')
|
||||
|
||||
saveFails(options, tap)
|
||||
|
||||
runAllFiles(options, saved, tap)
|
||||
|
||||
tap.end()
|
||||
}
|
||||
|
||||
function parseRcFile (path) {
|
||||
try {
|
||||
var contents = fs.readFileSync(path, 'utf8')
|
||||
return yaml.safeLoad(contents) || {}
|
||||
} catch (er) {
|
||||
// if no dotfile exists, or invalid yaml, fail gracefully
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
function strToRegExp (g) {
|
||||
var p = g.match(/^\/(.*)\/([a-z]*)$/)
|
||||
g = p ? p[1] : g
|
||||
var flags = p ? p[2] : ''
|
||||
return new RegExp(g, flags)
|
||||
}
|
||||
263
static/js/ketcher2/node_modules/tap/bin/usage.txt
generated
vendored
Normal file
263
static/js/ketcher2/node_modules/tap/bin/usage.txt
generated
vendored
Normal file
@ -0,0 +1,263 @@
|
||||
Usage:
|
||||
tap [options] <files>
|
||||
|
||||
Executes all the files and interprets their output as TAP
|
||||
formatted test result data.
|
||||
|
||||
To parse TAP data from stdin, specify "-" as a filename.
|
||||
|
||||
Short options are parsed gnu-style, so for example '-bCRspec' would be
|
||||
equivalent to '--bail --no-color --reporter=spec'
|
||||
|
||||
If the --check-coverage or --coverage-report options are provided, but
|
||||
no test files are specified, then a coverage report or coverage check
|
||||
will be run on the data from the last test run.
|
||||
|
||||
Coverage is never enabled for stdin.
|
||||
|
||||
Options:
|
||||
|
||||
-j<n> --jobs=<n> Run up to <n> test files in parallel
|
||||
Note that this causes tests to be run in
|
||||
"buffered" mode, so line-by-line results
|
||||
cannot be reported, and older TAP
|
||||
parsers may get upset.
|
||||
|
||||
-J --jobs-auto Run test files in parallel (auto calculated)
|
||||
Note that this causes tests to be run in
|
||||
"buffered" mode, so line-by-line results
|
||||
cannot be reported, and older TAP
|
||||
parsers may get upset.
|
||||
|
||||
-g<pattern> Only run subtests tests matching the specified
|
||||
--grep=<pattern> pattern.
|
||||
|
||||
Patterns are matched against top-level
|
||||
subtests in each file. To filter tests
|
||||
at subsequent levels, specify this
|
||||
option multiple times.
|
||||
|
||||
To specify regular expression flags,
|
||||
format pattern like a JavaScript RegExp
|
||||
literal. For example: '/xyz/i' for
|
||||
case-insensitive matching.
|
||||
|
||||
-i --invert Invert the matches to --grep patterns.
|
||||
(Like grep -v)
|
||||
|
||||
-c --color Use colors (Default for TTY)
|
||||
|
||||
-C --no-color Do not use colors (Default for non-TTY)
|
||||
|
||||
-b --bail Bail out on first failure
|
||||
|
||||
-B --no-bail Do not bail out on first failure (Default)
|
||||
|
||||
-O --only Only run tests with {only: true} option
|
||||
|
||||
-R<type> --reporter=<type> Use the specified reporter. Defaults to
|
||||
'classic' when colors are in use, or 'tap'
|
||||
when colors are disabled.
|
||||
|
||||
Available reporters:
|
||||
@@REPORTERS@@
|
||||
|
||||
-o<file> Send the raw TAP output to the specified
|
||||
--output-file=<file> file. Reporter output will still be
|
||||
printed to stdout, but the file will
|
||||
contain the raw TAP for later reply or
|
||||
analysis.
|
||||
|
||||
-s<file> --save=<file> If <file> exists, then it should be a line-
|
||||
delimited list of test files to run. If
|
||||
<file> is not present, then all command-line
|
||||
positional arguments are run.
|
||||
|
||||
After the set of test files are run, any
|
||||
failed test files are written back to the
|
||||
save file.
|
||||
|
||||
This way, repeated runs with -s<file> will
|
||||
re-run failures until all the failures are
|
||||
passing, and then once again run all tests.
|
||||
|
||||
It's a good idea to .gitignore the file
|
||||
used for this purpose, as it will churn a
|
||||
lot.
|
||||
|
||||
--coverage --cov Capture coverage information using 'nyc'
|
||||
|
||||
If a COVERALLS_REPO_TOKEN environment
|
||||
variable is set, then coverage is
|
||||
captured by default and sent to the
|
||||
coveralls.io service.
|
||||
|
||||
--no-coverage --no-cov Do not capture coverage information.
|
||||
Note that if nyc is already loaded, then
|
||||
the coverage info will still be captured.
|
||||
|
||||
--coverage-report=<type> Output coverage information using the
|
||||
specified istanbul/nyc reporter type.
|
||||
|
||||
Default is 'text' when running on the
|
||||
command line, or 'text-lcov' when piping
|
||||
to coveralls.
|
||||
|
||||
If 'html' is used, then the report will
|
||||
be opened in a web browser after running.
|
||||
|
||||
This can be run on its own at any time
|
||||
after a test run that included coverage.
|
||||
|
||||
--no-coverage-report Do not output a coverage report.
|
||||
|
||||
--no-browser Do not open a web browser after
|
||||
generating an html coverage report.
|
||||
|
||||
-t<n> --timeout=<n> Time out test files after <n> seconds.
|
||||
Defaults to 30, or the value of the
|
||||
TAP_TIMEOUT environment variable.
|
||||
Setting to 0 allows tests to run
|
||||
forever.
|
||||
|
||||
-T --no-timeout Do not time out tests.
|
||||
Equivalent to --timeout=0
|
||||
|
||||
-h --help print this thing you're looking at
|
||||
|
||||
-v --version show the version of this program
|
||||
|
||||
--node-arg=<arg> Pass an argument to Node binary in all
|
||||
child processes. Run 'node --help' to
|
||||
see a list of all relevant arguments.
|
||||
This can be specified multiple times to
|
||||
pass multiple args to Node.
|
||||
|
||||
-gc --expose-gc Expose the gc() function to Node tests
|
||||
|
||||
--debug Run JavaScript tests with node --debug
|
||||
|
||||
--debug-brk Run JavaScript tests with node --debug-brk
|
||||
|
||||
--harmony Enable all Harmony flags in JavaScript tests
|
||||
|
||||
--strict Run JS tests in 'use strict' mode
|
||||
|
||||
--test-arg=<arg> Pass an argument to test files spawned
|
||||
by the tap command line executable.
|
||||
This can be specified multiple times to
|
||||
pass multiple args to test scripts.
|
||||
|
||||
--nyc-arg=<arg> Pass an argument to nyc when running
|
||||
child processes with coverage enabled.
|
||||
This can be specified multiple times to
|
||||
pass multiple args to nyc.
|
||||
|
||||
--check-coverage Check whether coverage is within
|
||||
thresholds provided. Setting this
|
||||
explicitly will default --coverage to
|
||||
true.
|
||||
|
||||
This can be run on its own any time
|
||||
after a test run that included coverage.
|
||||
|
||||
--branches what % of branches must be covered?
|
||||
Setting this will default both
|
||||
--check-coverage and --coverage to true.
|
||||
[default: 0]
|
||||
|
||||
--functions what % of functions must be covered?
|
||||
Setting this explicitly will default both
|
||||
--check-coverage and --coverage to true.
|
||||
[default: 0]
|
||||
|
||||
--lines what % of lines must be covered?
|
||||
Setting this explicitly will default both
|
||||
--check-coverage and --coverage to true.
|
||||
[default: 90]
|
||||
|
||||
--statements what % of statements must be covered?
|
||||
Setting this explicitly will default both
|
||||
--check-coverage and --coverage to true.
|
||||
[default: 0]
|
||||
|
||||
--100 Full coverage, 100%.
|
||||
Sets branches, statements, functions,
|
||||
and lines to 100.
|
||||
|
||||
--nyc-help Print nyc usage banner. Useful for
|
||||
viewing options for --nyc-arg.
|
||||
|
||||
--nyc-version Print version of nyc used by tap.
|
||||
|
||||
--dump-config Dump the config options in JSON format.
|
||||
|
||||
-- Stop parsing flags, and treat any additional
|
||||
command line arguments as filenames.
|
||||
|
||||
Environment Variables:
|
||||
|
||||
TAP_RCFILE A yaml formatted file which can set any
|
||||
of the above options. Defaults to
|
||||
$HOME/.taprc
|
||||
|
||||
TAP_TIMEOUT Default value for --timeout option.
|
||||
|
||||
TAP_COLORS Set to '1' to force color output, or '0'
|
||||
to prevent color output.
|
||||
|
||||
TAP_BAIL Bail out on the first test failure.
|
||||
Used internally when '--bailout' is set.
|
||||
|
||||
TAP Set to '1' to force standard TAP output,
|
||||
and suppress any reporters. Used when
|
||||
running child tests so that their output
|
||||
is parseable by the test harness.
|
||||
|
||||
TAP_DIAG Set to '1' to show diagnostics by
|
||||
default for passing tests. Set to '0'
|
||||
to NOT show diagnostics by default for
|
||||
failing tests. If not one of these two
|
||||
values, then diagnostics are printed by
|
||||
default for failing tests, and not for
|
||||
passing tests.
|
||||
|
||||
TAP_BUFFER Set to '1' to run subtests in buffered
|
||||
mode by default.
|
||||
|
||||
TAP_DEV_LONGSTACK Set to '1' to include node-tap internals
|
||||
in stack traces. By default, these are
|
||||
included only when the current working
|
||||
directory is the tap project itself.
|
||||
Note that node internals are always
|
||||
excluded.
|
||||
|
||||
TAP_DEV_SHORTSTACK Set to '1' to exclude node-tap internals
|
||||
in stack traces, even if the current
|
||||
working directory is the tap project
|
||||
itself.
|
||||
|
||||
_TAP_COVERAGE_ Reserved for internal use.
|
||||
|
||||
TAP_DEBUG Set to '1' to turn on debug mode.
|
||||
|
||||
NODE_DEBUG Include 'tap' to turn on debug mode.
|
||||
|
||||
TAP_GREP A '\n'-delimited list of grep patterns
|
||||
to apply to root level test objects.
|
||||
(This is an implementation detail for how
|
||||
the '--grep' option works.)
|
||||
|
||||
TAP_GREP_INVERT Set to '1' to invert the meaning of the
|
||||
patterns in TAP_GREP. (Implementation
|
||||
detail for how the '--invert' flag
|
||||
works.)
|
||||
|
||||
Config Files:
|
||||
|
||||
You can create a yaml file with any of the options above. By default,
|
||||
the file at ~/.taprc will be loaded, but the TAP_RCFILE environment
|
||||
variable can modify this.
|
||||
|
||||
Run 'tap --dump-config' for a listing of what can be set in that file.
|
||||
Each of the keys corresponds to one of the options above.
|
||||
Reference in New Issue
Block a user