]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
test: deal with errors thrown from child processes
authorHaoqun Jiang <haoqunjiang@gmail.com>
Sat, 18 Sep 2021 09:31:44 +0000 (17:31 +0800)
committerHaoqun Jiang <haoqunjiang@gmail.com>
Sat, 18 Sep 2021 09:31:44 +0000 (17:31 +0800)
snapshot.js

index 74232cbaeb020ee263b3c5cab466375224e3fe81..58aa87222bb7d78625c76a036441ffabd2ba6ad5 100644 (file)
@@ -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']