Skip to content

Commit 86bded5

Browse files
authored
chore: hide confusing snyk output (#5485)
* chore: hide confusing snyk output * actually suppress output unless the snyk test fails
1 parent a33cc57 commit 86bded5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/snyk-test.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const execFile = promisify(childProcess.execFile);
99
async function snykTest(cwd) {
1010
const tmpPath = path.join(os.tmpdir(), 'tempfile-' + Date.now());
1111

12+
let execErr;
13+
1214
try {
1315
console.info(`testing ${cwd} ...`);
1416
await fs.mkdir(path.join(cwd, `node_modules`), { recursive: true });
@@ -24,17 +26,19 @@ async function snykTest(cwd) {
2426
'--dev',
2527
`--json-file-output=${tmpPath}`,
2628
],
27-
{ cwd, stdio: 'inherit' }
29+
{ cwd }
2830
);
2931
} catch (err) {
30-
console.warn(err);
32+
execErr = err;
3133
}
3234

3335
const res = JSON.parse(await fs.readFile(tmpPath));
3436
console.info(`testing ${cwd} done.`);
3537
return res;
3638
} catch (err) {
37-
console.error(`testing ${cwd} failed. ${err.message}`);
39+
console.error(
40+
`testing ${cwd} failed. ${err.message}. Exec error: ${execErr}`
41+
);
3842
} finally {
3943
try {
4044
await fs.rm(tmpPath);

0 commit comments

Comments
 (0)