Skip to content

Commit

Permalink
Merge pull request #1022 from abetomo/feature/improve_unit_testing_te…
Browse files Browse the repository at this point in the history
…ardown

test(improvement): Add tearDown to unit tests
  • Loading branch information
lamweili committed Jan 18, 2022
2 parents 05935cc + b5f320e commit c45bfeb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/tap/configuration-validation-test.js
@@ -1,4 +1,5 @@
const { test } = require("tap");
const { unlinkSync } = require("fs");
const util = require("util");
const path = require("path");
const sandbox = require("@log4js-node/sandboxed-module");
Expand Down Expand Up @@ -247,13 +248,21 @@ test("log4js configuration validation", batch => {
);

batch.test("should not throw error if configure object is freezed", t => {
const filename = "test/tap/freeze-date-file-test"
t.tearDown(() => {
try {
unlinkSync(filename);
} catch (_) {
// doesn't really matter if it failed
}
});
t.doesNotThrow(() =>
log4js.configure(
deepFreeze({
appenders: {
dateFile: {
filename,
type: "dateFile",
filename: "test/tap/freeze-date-file-test",
alwaysIncludePattern: false
}
},
Expand Down

0 comments on commit c45bfeb

Please sign in to comment.