You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
575 B
TypeScript

import { assertThrows } from "https://deno.land/std@0.146.0/testing/asserts.ts";
import { error } from "./log.ts";
Deno.test("log", async (t) => {
const testingPath = await Deno.makeTempFile();
await t.step("error handler", () => {
const errorHandler = error(testingPath);
assertThrows(() => {
errorHandler("Testing.");
});
});
await t.step("error handler debug mode", () => {
const errorHandler = error(testingPath, false, true);
assertThrows(() => {
errorHandler("Testing.");
});
});
await Deno.remove(testingPath);
});