@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 38 lines 1.55 KB
Raw
1 import { describe, expect, it } from "vitest";
2 import { NODE_BUNDLE_CONDITIONS } from "../../core/NodeServe.ts";
3 import { NITRO_HANDLER_SPECIFIER, NITRO_PRESET, makeNodeTarget, target } from "../node.ts";
4 import type { NitroConfigSlice } from "../UserConfig.ts";
5
6 describe("makeNodeTarget", () => {
7 it("declares the node platform, the node nitro preset, and a finish pass", () => {
8 const node = makeNodeTarget();
9 expect(node.platform).toBe("node");
10 expect(node.nitroPreset).toBe(NITRO_PRESET);
11 expect(NITRO_PRESET).toBe("node");
12 expect(NITRO_PRESET).not.toBe("aws-lambda");
13 expect(NITRO_PRESET).not.toBe("cloudflare_module");
14 expect(node.bundle?.conditions).toEqual([...NODE_BUNDLE_CONDITIONS]);
15 expect(node.bundle?.external ?? []).not.toContain("cloudflare:");
16 expect(node.bundle?.external ?? []).not.toContain("@aws-sdk/");
17 expect(node.build).toBeTypeOf("function");
18 expect(node.finish).toBeTypeOf("function");
19 });
20
21 it("does not wire the user entry at the config level", () => {
22 const node = makeNodeTarget({ main: "./server-entry.ts" });
23 const config: NitroConfigSlice = {};
24 node.configureNitro?.(config, {
25 root: "/project",
26 entry: "/project/server-entry.ts",
27 });
28 expect(config.entry).toBeUndefined();
29 });
30
31 it("exports the node-listener handler specifier for user entries", () => {
32 expect(NITRO_HANDLER_SPECIFIER).toBe("nitropack/presets/node/runtime/node-listener");
33 });
34
35 it("exposes the named `target` module export as the factory", () => {
36 expect(target).toBe(makeNodeTarget);
37 });
38 });