Skip to content

Commit

Permalink
test(improvement): Add tearDown to unit tests
Browse files Browse the repository at this point in the history
This leaves the following Untracked files.
`test/tap/freeze-date-file-test`
  • Loading branch information
abetomo committed May 26, 2020
1 parent f8d46a9 commit b5f320e
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 b5f320e

Please sign in to comment.