(
{
isolation,
globalSetupFile,
testFiles = ['test-file.js'],
env = {},
additionalFlags = [],
runnerEnabled = true,
}
)
| 13 | const onlyWithAmaro = { skip: !process.config.variables.node_use_amaro }; |
| 14 | |
| 15 | async function runTest( |
| 16 | { |
| 17 | isolation, |
| 18 | globalSetupFile, |
| 19 | testFiles = ['test-file.js'], |
| 20 | env = {}, |
| 21 | additionalFlags = [], |
| 22 | runnerEnabled = true, |
| 23 | } |
| 24 | ) { |
| 25 | const globalSetupPath = join(testFixtures, 'global-setup-teardown', globalSetupFile); |
| 26 | |
| 27 | const args = []; |
| 28 | |
| 29 | if (runnerEnabled) { |
| 30 | args.push('--test'); |
| 31 | } |
| 32 | |
| 33 | if (isolation) { |
| 34 | args.push(`--test-isolation=${isolation}`); |
| 35 | } |
| 36 | |
| 37 | args.push( |
| 38 | '--test-reporter=spec', |
| 39 | `--test-global-setup=${globalSetupPath}` |
| 40 | ); |
| 41 | |
| 42 | if (additionalFlags.length > 0) { |
| 43 | args.push(...additionalFlags); |
| 44 | } |
| 45 | |
| 46 | const testFilePaths = testFiles.map((file) => join(testFixtures, 'global-setup-teardown', file)); |
| 47 | args.push(...testFilePaths); |
| 48 | |
| 49 | const child = spawn( |
| 50 | process.execPath, |
| 51 | args, |
| 52 | { |
| 53 | encoding: 'utf8', |
| 54 | stdio: 'pipe', |
| 55 | env: { |
| 56 | ...process.env, |
| 57 | ...env |
| 58 | } |
| 59 | } |
| 60 | ); |
| 61 | |
| 62 | let stdout = ''; |
| 63 | let stderr = ''; |
| 64 | |
| 65 | child.stdout.on('data', (data) => { |
| 66 | stdout += data.toString(); |
| 67 | }); |
| 68 | |
| 69 | child.stderr.on('data', (data) => { |
| 70 | stderr += data.toString(); |
| 71 | }); |
| 72 |
no test coverage detected
searching dependent graphs…