Skip to content

Commit dba5f28

Browse files
committed
Fix tests on Windows
1 parent 8b89972 commit dba5f28

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

src/test/utils/fs.test.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
glob,
99
inferPackageEntryPointPaths,
1010
} from "../../lib/utils/fs.js";
11+
import { normalizePath } from "../../lib/utils/paths.js";
1112

1213
describe("fs.ts", () => {
1314
describe("getCommonDirectory", () => {
@@ -177,6 +178,8 @@ describe("fs.ts", () => {
177178
describe("inferPackageEntryPointPaths", () => {
178179
const fixture = tempdirProject();
179180
afterEach(() => fixture.rm());
181+
const packagePath = (path: string) =>
182+
normalizePath(join(fixture.cwd, path));
180183

181184
it("Supports string exports shorthand", () => {
182185
const pkg = fixture.addJsonFile("package.json", {
@@ -186,7 +189,7 @@ describe("fs.ts", () => {
186189
fixture.write();
187190

188191
equal(inferPackageEntryPointPaths(pkg.path), [
189-
[".", join(fixture.cwd, "exp.js")],
192+
[".", packagePath("exp.js")],
190193
]);
191194
});
192195

@@ -197,7 +200,7 @@ describe("fs.ts", () => {
197200
fixture.write();
198201

199202
equal(inferPackageEntryPointPaths(pkg.path), [
200-
[".", join(fixture.cwd, "main.js")],
203+
[".", packagePath("main.js")],
201204
]);
202205
});
203206

@@ -211,8 +214,8 @@ describe("fs.ts", () => {
211214
fixture.write();
212215

213216
equal(inferPackageEntryPointPaths(pkg.path), [
214-
[".", join(fixture.cwd, "main.js")],
215-
["foo", join(fixture.cwd, "foo.js")],
217+
[".", packagePath("main.js")],
218+
["foo", packagePath("foo.js")],
216219
]);
217220
});
218221

@@ -241,11 +244,11 @@ describe("fs.ts", () => {
241244
fixture.write();
242245

243246
equal(inferPackageEntryPointPaths(pkg.path), [
244-
[".", join(fixture.cwd, "main.js")],
245-
["a", join(fixture.cwd, "a.ts")],
246-
["b", join(fixture.cwd, "b.ts")],
247-
["c", join(fixture.cwd, "c.ts")],
248-
["d", join(fixture.cwd, "d.js")],
247+
[".", packagePath("main.js")],
248+
["a", packagePath("a.ts")],
249+
["b", packagePath("b.ts")],
250+
["c", packagePath("c.ts")],
251+
["d", packagePath("d.js")],
249252
]);
250253
});
251254

@@ -261,8 +264,8 @@ describe("fs.ts", () => {
261264
fixture.write();
262265

263266
equal(inferPackageEntryPointPaths(pkg.path), [
264-
[".", join(fixture.cwd, "main.js")],
265-
["a", join(fixture.cwd, "exists.js")],
267+
[".", packagePath("main.js")],
268+
["a", packagePath("exists.js")],
266269
]);
267270
});
268271

@@ -283,7 +286,7 @@ describe("fs.ts", () => {
283286
fixture.write();
284287

285288
equal(inferPackageEntryPointPaths(pkg.path), [
286-
["a", join(fixture.cwd, "a.ts")],
289+
["a", packagePath("a.ts")],
287290
]);
288291
});
289292

@@ -302,10 +305,10 @@ describe("fs.ts", () => {
302305
fixture.write();
303306

304307
equal(inferPackageEntryPointPaths(pkg.path), [
305-
["a/1.js", join(fixture.cwd, "src/1.js")],
306-
["a/2.js", join(fixture.cwd, "src/2.js")],
307-
["a/3/4.js", join(fixture.cwd, "src/3/4.js")],
308-
["b/6.js", join(fixture.cwd, "src/6/6.ts")],
308+
["a/1.js", packagePath("src/1.js")],
309+
["a/2.js", packagePath("src/2.js")],
310+
["a/3/4.js", packagePath("src/3/4.js")],
311+
["b/6.js", packagePath("src/6/6.ts")],
309312
]);
310313
});
311314
});

0 commit comments

Comments
 (0)