Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

cliErrors.test.ts

31 lines1.0 KB

1import { assert, describe, it } from "@effect/vitest";
2​
3import { ServerCliBuildAssetMissingError, ServerCliCommandExitError } from "./cliErrors.ts";
4​
5describe("server CLI errors", () => {
6 it("preserves failed command context without changing its message", () => {
7 const error = new ServerCliCommandExitError({
8 command: "vp",
9 args: ["pm", "publish"],
10 cwd: "/repo",
11 exitCode: 17,
12 });
13​
14 assert.equal(error._tag, "ServerCliCommandExitError");
15 assert.equal(error.command, "vp");
16 assert.deepEqual(error.args, ["pm", "publish"]);
17 assert.equal(error.cwd, "/repo");
18 assert.equal(error.exitCode, 17);
19 assert.equal(error.message, "Command exited with non-zero exit code (17)");
20 });
21​
22 it("preserves a representative missing asset path", () => {
23 const error = new ServerCliBuildAssetMissingError({ assetPath: "/repo/server.mjs" });
24​
25 assert.equal(error.assetPath, "/repo/server.mjs");
26 assert.equal(
27 error.message,
28 "Missing build asset: /repo/server.mjs. Run the build subcommand first.",
29 );
30 });
31});