chore(test): improve test coverage for fileAppender

appenders/file.js - Line 70 - return d;
This commit is contained in:
Lam Wei Li 2022-02-04 17:43:37 +08:00
parent 42eb04e266
commit d94284aeb8
No known key found for this signature in database
GPG Key ID: 90F6ABECF080D7BF

View File

@ -386,19 +386,19 @@ test("log4js fileAppender", batch => {
});
logger.info("This should be in the file.",
"\x1b[33mColor\x1b[0m \x1b[93;41mshould\x1b[0m be \x1b[38;5;8mplain\x1b[0m.");
"\x1b[33mColor\x1b[0m \x1b[93;41mshould\x1b[0m be \x1b[38;5;8mplain\x1b[0m.", {}, []);
await sleep(100);
let fileContents = await fs.readFile(testFilePlain, "utf8");
t.match(fileContents, `This should be in the file. Color should be plain.${EOL}`);
t.match(fileContents, `This should be in the file. Color should be plain. {} []${EOL}`);
t.match(
fileContents,
/\[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}] \[INFO] default-settings - /
);
fileContents = await fs.readFile(testFileAsIs, "utf8");
t.match(fileContents, "This should be in the file.",
`\x1b[33mColor\x1b[0m \x1b[93;41mshould\x1b[0m be \x1b[38;5;8mplain\x1b[0m.${EOL}`);
`\x1b[33mColor\x1b[0m \x1b[93;41mshould\x1b[0m be \x1b[38;5;8mplain\x1b[0m. {} []${EOL}`);
t.match(
fileContents,
/\[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}] \[INFO] default-settings - /