From 5c6de33fbca76092281d7e52389e81f60c074c47 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Sat, 18 Sep 2021 17:31:44 +0800 Subject: [PATCH] test: deal with errors thrown from child processes --- snapshot.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/snapshot.js b/snapshot.js index 74232cba..58aa8722 100644 --- a/snapshot.js +++ b/snapshot.js @@ -6,9 +6,18 @@ const playgroundDir = new URL('./playground/', import.meta.url).pathname function createProjectWithFeatureFlags(flags) { const projectName = flags.join('-') console.log(`Creating project ${projectName}`) - spawnSync('node', [bin, projectName, ...flags.map((flag) => `--${flag}`), '--force'], { - cwd: playgroundDir - }) + const { status } = spawnSync( + 'node', + [bin, projectName, ...flags.map((flag) => `--${flag}`), '--force'], + { + cwd: playgroundDir, + stdio: ['pipe', 'pipe', 'inherit'] + } + ) + + if (status !== 0) { + process.exit(status) + } } const featureFlags = ['typescript', 'jsx', 'router', 'vuex', 'with-tests'] -- 2.39.5