| 1 | import { describe, expect, it } from "vitest"; |
| 2 | import { NODE_BUNDLE_CONDITIONS } from "../../core/NodeServe.ts"; |
| 3 | import { makeNodeTarget, target } from "../node.ts"; |
| 4 | |
| 5 | describe("makeNodeTarget", () => { |
| 6 | it("is an assets-only node target whose only seam is the wholesale child build", () => { |
| 7 | const node = makeNodeTarget({ vite: { outDir: "dist" } }); |
| 8 | expect(node.platform).toBe("node"); |
| 9 | expect(node.build).toBeTypeOf("function"); |
| 10 | expect(node.finish).toBeTypeOf("function"); |
| 11 | expect(node.entry).toBeUndefined(); |
| 12 | expect(node.bundle?.conditions).toEqual([...NODE_BUNDLE_CONDITIONS]); |
| 13 | expect(node.bundle?.external ?? []).not.toContain("cloudflare:"); |
| 14 | expect(node.bundle?.external ?? []).not.toContain("@aws-sdk/"); |
| 15 | expect(node.config).toEqual({ vite: { outDir: "dist" } }); |
| 16 | }); |
| 17 | |
| 18 | it("exposes the named `target` module export as the factory", () => { |
| 19 | expect(target).toBe(makeNodeTarget); |
| 20 | }); |
| 21 | }); |