| 1 |
'use strict' |
| 2 |
process.env.NYC_CONFIG = '' |
| 3 |
|
| 4 |
const {ProcessDB, ProcessInfo} = require('../') |
| 5 |
|
| 6 |
const path = require('path') |
| 7 |
const t = require('tap') |
| 8 |
const fs = require('fs') |
| 9 |
const rimraf = require('rimraf').sync |
| 10 |
|
| 11 |
t.throws(() => new ProcessDB(), |
| 12 |
new TypeError('must provide directory argument when outside of NYC')) |
| 13 |
|
| 14 |
t.equal(new ProcessInfo().directory, undefined) |
| 15 |
|
| 16 |
t.test('spawnArgs from outside nyc', t => { |
| 17 |
const _spawnArgs = Symbol.for('spawnArgs') |
| 18 |
const dir = path.resolve(__dirname, 'fixtures/.nyc_output/processinfo') |
| 19 |
const pdb = new ProcessDB(dir) |
| 20 |
t.matchSnapshot(pdb[_spawnArgs]('has an nyc', 'node', ['ok.js'], { |
| 21 |
nyc: '/path/to/nyc', |
| 22 |
nycArgs: ['--clean=false'], |
| 23 |
env: { x: 'y' }, |
| 24 |
})) |
| 25 |
t.matchSnapshot(pdb[_spawnArgs]('has no nyc', 'node', ['ok.js'], { |
| 26 |
env: { x: 'y' }, |
| 27 |
})) |
| 28 |
t.end() |
| 29 |
}) |