From: Haoqun Jiang Date: Sat, 18 Sep 2021 09:31:44 +0000 (+0800) Subject: test: deal with errors thrown from child processes X-Git-Tag: v3.0.0-beta.4~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c6de33fbca76092281d7e52389e81f60c074c47;p=thirdparty%2Fvuejs%2Fcreate-vue.git test: deal with errors thrown from child processes --- 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']