From e733dab0fabf552ffbb3034fcebc58268ff80686 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 6 Oct 2021 22:30:30 +0800 Subject: [PATCH] test: fix leading slash issue on Windows --- snapshot.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/snapshot.js b/snapshot.js index 58aa8722..06f3e39c 100644 --- a/snapshot.js +++ b/snapshot.js @@ -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('-') -- 2.39.5