(entry, env)
| 6 | const assert = require('assert'); |
| 7 | |
| 8 | function buildSnapshot(entry, env) { |
| 9 | const child = spawnSync(process.execPath, [ |
| 10 | '--snapshot-blob', |
| 11 | tmpdir.resolve('snapshot.blob'), |
| 12 | '--build-snapshot', |
| 13 | entry, |
| 14 | ], { |
| 15 | cwd: tmpdir.path, |
| 16 | env: { |
| 17 | ...process.env, |
| 18 | ...env, |
| 19 | }, |
| 20 | }); |
| 21 | |
| 22 | const stderr = child.stderr.toString(); |
| 23 | const stdout = child.stdout.toString(); |
| 24 | console.log('[stderr]'); |
| 25 | console.log(stderr); |
| 26 | console.log('[stdout]'); |
| 27 | console.log(stdout); |
| 28 | |
| 29 | assert.strictEqual(child.status, 0); |
| 30 | |
| 31 | const stats = fs.statSync(tmpdir.resolve('snapshot.blob')); |
| 32 | assert(stats.isFile()); |
| 33 | |
| 34 | return { child, stderr, stdout }; |
| 35 | } |
| 36 | |
| 37 | function runWithSnapshot(entry, env) { |
| 38 | const args = ['--snapshot-blob', tmpdir.resolve('snapshot.blob')]; |
no test coverage detected
searching dependent graphs…