From 9a6484c488dc2d76930ef90132686632d3320b50 Mon Sep 17 00:00:00 2001 From: NightKnight Date: Tue, 5 Mar 2024 20:08:47 +0200 Subject: [PATCH] Tools: Fix `packages\lib\fsDriver.test.ts` test file on Windows (#10053) --- packages/lib/fsDriver.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/lib/fsDriver.test.ts b/packages/lib/fsDriver.test.ts index eb9a5b56b..4a6e2d2bd 100644 --- a/packages/lib/fsDriver.test.ts +++ b/packages/lib/fsDriver.test.ts @@ -2,11 +2,13 @@ import FsDriverNode from './fs-driver-node'; import shim from './shim'; import { expectThrow } from './testing/test-utils'; +const windowsPartitionLetter = __filename[0]; + // On Windows, path.resolve is going to convert a path such as -// /tmp/file.txt to c:\tmp\file.txt +// /tmp/file.txt to {partition}:\tmp\file.txt function platformPath(path: string) { if (shim.isWindows()) { - return `c:${path.replace(/\//g, '\\')}`; + return `${windowsPartitionLetter}:${path.replace(/\//g, '\\')}`; } else { return path; }