mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
* Do not run tests outside test scope * Fix tests * Fix type errors and remove potentially precarious uses of unreachable * yoops * Remove all instances of "Ruh roh" --------- Co-authored-by: Zack Radisic <56137411+zackradisic@users.noreply.github.com>
24 lines
881 B
TypeScript
24 lines
881 B
TypeScript
import { $ } from "bun";
|
|
import { describe, test, expect } from "bun:test";
|
|
import { createTestBuilder } from "../test_builder";
|
|
const TestBuilder = createTestBuilder(import.meta.path);
|
|
import { sortedShellOutput } from "../util";
|
|
import { join } from "path";
|
|
|
|
describe("exit", async () => {
|
|
TestBuilder.command`exit`.exitCode(0).runAsTest("works");
|
|
|
|
describe("argument sets exit code", async () => {
|
|
for (const arg of [0, 2, 11]) {
|
|
TestBuilder.command`exit ${arg}`.exitCode(arg).runAsTest(`${arg}`);
|
|
}
|
|
});
|
|
|
|
TestBuilder.command`exit 3 5`.exitCode(1).stderr("exit: too many arguments\n").runAsTest("too many arguments");
|
|
|
|
TestBuilder.command`exit 62757836`.exitCode(204).runAsTest("exit code wraps u8");
|
|
|
|
// prettier-ignore
|
|
TestBuilder.command`exit abc`.exitCode(1).stderr("exit: numeric argument required\n").runAsTest("numeric argument required");
|
|
});
|