Skip to content

Commit

Permalink
chore: windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
magne4000 committed Jul 17, 2024
1 parent 29fbcae commit 64ac9ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions packages/universal-middleware/test/esbuild.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -165,10 +165,10 @@ describe("esbuild", () => {
).toHaveLength(expectNbOutput(2));

expect(findOutput(result, entry1)).toSatisfy((s: string) =>

Check failure on line 167 in packages/universal-middleware/test/esbuild.test.ts

View workflow job for this annotation

GitHub Actions / CI tests on node-20, windows-latest

test/esbuild.test.ts > esbuild > respects outbase

AssertionError: expected 'dist/test/files/folder1/handler.js' to satisfy [Function] - Expected + Received - true + false ❯ test/esbuild.test.ts:167:40
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);
Expand Down Expand Up @@ -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"),
);
});

Expand Down
4 changes: 2 additions & 2 deletions packages/universal-middleware/test/rollup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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}`,
);
}
Expand Down

0 comments on commit 64ac9ce

Please sign in to comment.