mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 13:22:07 +00:00
move & add
This commit is contained in:
6
test/js/bun/test/printing/consolelog.fixture.ts
Normal file
6
test/js/bun/test/printing/consolelog.fixture.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
console.log("--- begin ---");
|
||||
console.log({
|
||||
a: "a",
|
||||
multiline: 'pub fn main() !void {\n std.log.info("Hello, {s}", .{name});\n}',
|
||||
});
|
||||
console.log("--- end ---");
|
||||
25
test/js/bun/test/printing/consolelogexample.test.ts
Normal file
25
test/js/bun/test/printing/consolelogexample.test.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { test, expect } from "bun:test";
|
||||
import { bunExe } from "harness";
|
||||
|
||||
test("console.log output", async () => {
|
||||
const result = Bun.spawn({
|
||||
cmd: [bunExe(), import.meta.dir + "/consolelog.fixture.ts"],
|
||||
stdio: ["inherit", "pipe", "pipe"],
|
||||
});
|
||||
await result.exited;
|
||||
const stdout = await result.stdout.text();
|
||||
const stderr = await result.stderr.text();
|
||||
expect(stderr).toBe("");
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(stdout).toMatchInlineSnapshot(`
|
||||
"--- begin ---
|
||||
{
|
||||
a: a,
|
||||
multiline: "pub fn main() !void {
|
||||
std.log.info(\\"Hello, {s}\\", .{name});
|
||||
}",
|
||||
}
|
||||
--- end ---
|
||||
"
|
||||
`);
|
||||
});
|
||||
Reference in New Issue
Block a user