]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
test: fix leading slash issue on Windows
authorHaoqun Jiang <haoqunjiang@gmail.com>
Wed, 6 Oct 2021 14:30:30 +0000 (22:30 +0800)
committerHaoqun Jiang <haoqunjiang@gmail.com>
Wed, 6 Oct 2021 14:30:30 +0000 (22:30 +0800)
snapshot.js

index 58aa87222bb7d78625c76a036441ffabd2ba6ad5..06f3e39c87c13e84bc696890578e6b56727d4161 100644 (file)
@@ -1,7 +1,12 @@
 import { spawnSync } from 'child_process'
+import path from 'path'
 
-const bin = new URL('./outfile.cjs', import.meta.url).pathname
-const playgroundDir = new URL('./playground/', import.meta.url).pathname
+const __dirname = path
+  .dirname(new URL(import.meta.url).pathname)
+  .substring(process.platform === 'win32' ? 1 : 0)
+
+const bin = path.resolve(__dirname, './outfile.cjs')
+const playgroundDir = path.resolve(__dirname, './playground/')
 
 function createProjectWithFeatureFlags(flags) {
   const projectName = flags.join('-')