]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
fix: snapshot generation (#383)
authorCédric Exbrayat <cexbrayat@users.noreply.github.com>
Fri, 24 Nov 2023 07:31:08 +0000 (08:31 +0100)
committerGitHub <noreply@github.com>
Fri, 24 Nov 2023 07:31:08 +0000 (15:31 +0800)
scripts/snapshot.mjs

index 6b0b9ff0159d28f9d4ff55ccb9ccee7955232d29..5e0224c2e40db5bc0ecf9afd03fb9dde9abb1010 100644 (file)
@@ -17,7 +17,12 @@ const featureFlags = [
   'playwright',
   'nightwatch'
 ]
-const featureFlagsDenylist = [['cypress', 'playwright', 'nightwatch']]
+const featureFlagsDenylist = [
+  ['cypress', 'playwright'],
+  ['playwright', 'nightwatch'],
+  ['cypress', 'nightwatch'],
+  ['cypress', 'playwright', 'nightwatch']
+]
 
 // The following code & comments are generated by GitHub CoPilot.
 function fullCombination(arr) {
@@ -51,12 +56,6 @@ function fullCombination(arr) {
 let flagCombinations = fullCombination(featureFlags)
 flagCombinations.push(['default'])
 
-// Filter out combinations that are not allowed
-flagCombinations = flagCombinations.filter(
-  (combination) =>
-    !featureFlagsDenylist.some((denylist) => denylist.every((flag) => combination.includes(flag)))
-)
-
 // `--with-tests` are equivalent of `--vitest --cypress`
 // Previously it means `--cypress` without `--vitest`.
 // Here we generate the snapshots only for the sake of easier comparison with older templates.
@@ -70,14 +69,26 @@ withTestsFlags.push(['with-tests'])
 flagCombinations.push(...withTestsFlags)
 
 const playgroundDir = path.resolve(__dirname, '../playground/')
-const bin = path.posix.relative('../playground/', '../outfile.cjs')
-
 cd(playgroundDir)
+
+// remove all previous combinations
 for (const flags of flagCombinations) {
   const projectName = flags.join('-')
 
   console.log(`Removing previously generated project ${projectName}`)
   fs.rmSync(projectName, { recursive: true, force: true })
+}
+
+// Filter out combinations that are not allowed
+flagCombinations = flagCombinations.filter(
+  (combination) =>
+    !featureFlagsDenylist.some((denylist) => denylist.every((flag) => combination.includes(flag)))
+)
+
+const bin = path.posix.relative('../playground/', '../outfile.cjs')
+
+for (const flags of flagCombinations) {
+  const projectName = flags.join('-')
 
   console.log(`Creating project ${projectName}`)
   await $`node ${[bin, projectName, ...flags.map((flag) => `--${flag}`), '--force']}`