test(generators): e2e byte-identical reconstruction of core-realtime
This commit is contained in:
24
turbo/generators/__tests__/core-package-realtime.e2e.test.ts
Normal file
24
turbo/generators/__tests__/core-package-realtime.e2e.test.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import { describe, it, expect } from "vitest";
|
||||||
|
import { mkdtempSync, cpSync, readFileSync } from "node:fs";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
|
import { execSync } from "node:child_process";
|
||||||
|
import { join } from "node:path";
|
||||||
|
import { computeSnapshot } from "../lib/snapshot";
|
||||||
|
import expectedSnapshot from "../__snapshots__/core-package/realtime.snapshot.json";
|
||||||
|
|
||||||
|
describe("e2e: core-package realtime", () => {
|
||||||
|
it("byte-identical reconstruction matches snapshot", { timeout: 120_000 }, () => {
|
||||||
|
const tmp = mkdtempSync(join(tmpdir(), "e2e-"));
|
||||||
|
cpSync(process.cwd(), tmp, {
|
||||||
|
recursive: true,
|
||||||
|
filter: (src) =>
|
||||||
|
!src.includes("node_modules") &&
|
||||||
|
!src.includes(".turbo") &&
|
||||||
|
!src.includes("packages/core-realtime"),
|
||||||
|
});
|
||||||
|
execSync(`cd ${tmp} && pnpm install --frozen-lockfile=false`, { stdio: "ignore" });
|
||||||
|
execSync(`cd ${tmp} && pnpm turbo gen core-package --args realtime`, { stdio: "ignore" });
|
||||||
|
const result = computeSnapshot(join(tmp, "packages/core-realtime"));
|
||||||
|
expect(result).toEqual(expectedSnapshot);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -4,7 +4,7 @@ export default defineConfig({
|
|||||||
test: {
|
test: {
|
||||||
globals: true,
|
globals: true,
|
||||||
environment: "node",
|
environment: "node",
|
||||||
include: ["*.test.ts", "lib/*.test.ts"],
|
include: ["*.test.ts", "lib/*.test.ts", "__tests__/*.test.ts"],
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
restoreMocks: true,
|
restoreMocks: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user