Files
bun.sh/test/js/web/console/console-timeLog.test.ts
Jarred Sumner 2e02d9de28 Use ReadableStream.prototype.* in tests instead of new Response(...).* (#20937)
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Alistair Smith <hi@alistair.sh>
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
2025-07-14 00:47:53 -07:00

22 lines
692 B
TypeScript

import { file, spawn } from "bun";
import { expect, it } from "bun:test";
import { bunEnv, bunExe } from "harness";
import { join } from "node:path";
it("should log to console correctly", async () => {
const { stderr, exited } = spawn({
cmd: [bunExe(), join(import.meta.dir, "console-timeLog.js")],
stdin: null,
stdout: "pipe",
stderr: "pipe",
env: bunEnv,
});
expect(await exited).toBe(0);
const outText = await stderr.text();
const expectedText = (await file(join(import.meta.dir, "console-timeLog.expected.txt")).text()).replaceAll(
"\r\n",
"\n",
);
expect(outText.replace(/^\[.+?s\] /gm, "")).toBe(expectedText.replace(/^\[.+?s\] /gm, ""));
});