| 1 |
'use strict' |
| 2 |
|
| 3 |
const runNYC = require('./run-nyc') |
| 4 |
|
| 5 |
async function envCheckConfig (t, { configArgs, checkOptions }) { |
| 6 |
const { stdout, stderr, status } = await runNYC({ |
| 7 |
tempDir: t.tempDir, |
| 8 |
leavePathSep: true, |
| 9 |
args: [ |
| 10 |
...configArgs, |
| 11 |
process.execPath, |
| 12 |
'./env.js' |
| 13 |
] |
| 14 |
}) |
| 15 |
|
| 16 |
const config = JSON.parse(JSON.parse(stdout).NYC_CONFIG) |
| 17 |
|
| 18 |
t.is(status, 0) |
| 19 |
t.is(stderr, '') |
| 20 |
t.matchSnapshot( |
| 21 |
JSON.stringify( |
| 22 |
checkOptions.sort().map(option => [option, config[option]]), |
| 23 |
null, |
| 24 |
2 |
| 25 |
) |
| 26 |
) |
| 27 |
} |
| 28 |
|
| 29 |
module.exports = envCheckConfig |