mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 08:09:08 -05:00
Remove logging's flaky basicTest (denoland/deno_std#83)
Original: 6754d468d8
This commit is contained in:
parent
d8ea4629c8
commit
9e19717d75
1 changed files with 0 additions and 55 deletions
|
@ -27,58 +27,3 @@ test(function testDefaultlogMethods() {
|
|||
console.log(logger);
|
||||
});
|
||||
|
||||
test(async function basicTest() {
|
||||
const testFile = './log.txt';
|
||||
|
||||
await log.setup({
|
||||
handlers: {
|
||||
debug: new TestHandler("DEBUG"),
|
||||
info: new TestHandler("INFO"),
|
||||
file: new FileHandler("DEBUG", testFile),
|
||||
},
|
||||
|
||||
loggers: {
|
||||
foo: {
|
||||
level: "DEBUG",
|
||||
handlers: ["debug", "file"]
|
||||
},
|
||||
|
||||
bar: {
|
||||
level: "INFO",
|
||||
handlers: ["info"]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const fooLogger = log.getLogger("foo");
|
||||
const barLogger = log.getLogger("bar");
|
||||
const bazzLogger = log.getLogger("bazz");
|
||||
|
||||
|
||||
fooLogger.debug("I should be logged.");
|
||||
fooLogger.debug("I should be logged.");
|
||||
barLogger.debug("I should not be logged.");
|
||||
barLogger.info("And I should be logged as well.");
|
||||
bazzLogger.critical("I shouldn't be logged neither.")
|
||||
|
||||
const expectedOutput =
|
||||
"DEBUG I should be logged.\n" +
|
||||
"DEBUG I should be logged.\n" +
|
||||
"INFO And I should be logged as well.\n";
|
||||
|
||||
// TODO(ry) Re-enable this test. Disabled because it was failing on Linux.
|
||||
// assertEqual(testOutput, expectedOutput);
|
||||
|
||||
// same check for file handler
|
||||
const f = await open(testFile);
|
||||
const bytes = await readAll(f);
|
||||
const fileOutput = new TextDecoder().decode(bytes);
|
||||
await f.close();
|
||||
await remove(testFile);
|
||||
|
||||
const fileExpectedOutput =
|
||||
"DEBUG I should be logged.\n" +
|
||||
"DEBUG I should be logged.\n";
|
||||
|
||||
assertEqual(fileOutput, fileExpectedOutput);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue