From 64ac9ceea836dd317ca70fab32d5a2368c9b426d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Charles?= Date: Wed, 17 Jul 2024 14:25:43 +0200 Subject: [PATCH] chore: windows tests --- .../universal-middleware/test/esbuild.test.ts | 20 +++++++++---------- .../universal-middleware/test/rollup.test.ts | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/universal-middleware/test/esbuild.test.ts b/packages/universal-middleware/test/esbuild.test.ts index c4f08e9..f9b11b6 100644 --- a/packages/universal-middleware/test/esbuild.test.ts +++ b/packages/universal-middleware/test/esbuild.test.ts @@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest"; import { build, type BuildResult } from "esbuild"; import unplugin from "../src/build"; -import { join, posix } from "node:path"; +import { join } from "node:path"; describe("esbuild", () => { it("generates all server files (in/out input)", async () => { @@ -96,10 +96,10 @@ describe("esbuild", () => { ).toHaveLength(expectNbOutput(2)); expect(findOutput(result, entry1)).toSatisfy((s: string) => - posix.normalize(s).startsWith("dist/test/files/folder1/handler"), + s.startsWith("dist/test/files/folder1/handler"), ); expect(findOutput(result, entry2)).toSatisfy((s: string) => - posix.normalize(s).startsWith("dist/test/files/middleware"), + s.startsWith("dist/test/files/middleware"), ); testEsbuildOutput(result, "handler", entry1); @@ -130,10 +130,10 @@ describe("esbuild", () => { ).toHaveLength(expectNbOutput(2)); expect(findOutput(result, entry1)).toSatisfy((s: string) => - posix.normalize(s).startsWith("dist/test/files/folder1/handler"), + s.startsWith("dist/test/files/folder1/handler"), ); expect(findOutput(result, entry2)).toSatisfy((s: string) => - posix.normalize(s).startsWith("dist/test/files/folder2/handler"), + s.startsWith("dist/test/files/folder2/handler"), ); testEsbuildOutput(result, "handler", entry1); @@ -147,7 +147,7 @@ describe("esbuild", () => { entryPoints: [entry1 + "?handler", entry2 + "?handler"], plugins: [unplugin.esbuild()], outdir: "dist", - outbase: "test/files", + outbase: join("test", "files"), write: false, metafile: true, bundle: true, @@ -165,10 +165,10 @@ describe("esbuild", () => { ).toHaveLength(expectNbOutput(2)); expect(findOutput(result, entry1)).toSatisfy((s: string) => - posix.normalize(s).startsWith("dist/folder1/handler"), + s.startsWith("dist/folder1/handler"), ); expect(findOutput(result, entry2)).toSatisfy((s: string) => - posix.normalize(s).startsWith("dist/folder2/handler"), + s.startsWith("dist/folder2/handler"), ); testEsbuildOutput(result, "handler", entry1); @@ -203,10 +203,10 @@ describe("esbuild", () => { ).toHaveLength(4); expect(findOutput(result, entry1)).toSatisfy((s: string) => - posix.normalize(s).startsWith("dist/test/files/folder1/handler"), + s.startsWith("dist/test/files/folder1/handler"), ); expect(findOutput(result, entry2)).toSatisfy((s: string) => - posix.normalize(s).startsWith("dist/test/files/folder2/handler"), + s.startsWith("dist/test/files/folder2/handler"), ); }); diff --git a/packages/universal-middleware/test/rollup.test.ts b/packages/universal-middleware/test/rollup.test.ts index 4baffa7..29dfd90 100644 --- a/packages/universal-middleware/test/rollup.test.ts +++ b/packages/universal-middleware/test/rollup.test.ts @@ -5,7 +5,7 @@ import { type OutputChunk, rollup, type RollupOutput } from "rollup"; import { nodeResolve } from "@rollup/plugin-node-resolve"; import typescript from "@rollup/plugin-typescript"; import unplugin from "../src/build"; -import { join, parse, posix } from "node:path"; +import { join, parse } from "node:path"; describe("rollup", () => { it("generates all server files (string input)", async () => { @@ -226,7 +226,7 @@ function testRollupHandler( file.facadeModuleId === `virtual:universal-middleware:${server}:${type}:${f}`, ) as OutputChunk | undefined; - expect(posix.normalize(res!.name)).toEqual( + expect(res!.name.replaceAll("\\", "/")).toEqual( `${parsed.dir}/universal-${server}-${type}-${parsed.name}`, ); }