diff --git a/test/tap/appender-dependencies-test.js b/test/tap/appender-dependencies-test.js index 045c8c1..4c680e7 100644 --- a/test/tap/appender-dependencies-test.js +++ b/test/tap/appender-dependencies-test.js @@ -8,12 +8,18 @@ let log4js; let recording; test('log4js appender dependencies', (batch) => { - batch.beforeEach(() => { + batch.beforeEach((done) => { log4js = require('../../lib/log4js'); recording = require('../../lib/appenders/recording'); + if (typeof done === 'function') { + done(); + } }); - batch.afterEach(() => { + batch.afterEach((done) => { recording.erase(); + if (typeof done === 'function') { + done(); + } }); batch.test('in order', (t) => { const config = { diff --git a/test/tap/categoryFilter-test.js b/test/tap/categoryFilter-test.js index af9bba7..40c2840 100644 --- a/test/tap/categoryFilter-test.js +++ b/test/tap/categoryFilter-test.js @@ -3,8 +3,11 @@ const log4js = require('../../lib/log4js'); const recording = require('../../lib/appenders/recording'); test('log4js categoryFilter', (batch) => { - batch.beforeEach(() => { + batch.beforeEach((done) => { recording.reset(); + if (typeof done === 'function') { + done(); + } }); batch.test('appender should exclude categories', (t) => { diff --git a/test/tap/configuration-test.js b/test/tap/configuration-test.js index 1fced15..dfcaeac 100644 --- a/test/tap/configuration-test.js +++ b/test/tap/configuration-test.js @@ -10,7 +10,7 @@ let dependencies; let fileRead; test('log4js configure', (batch) => { - batch.beforeEach(() => { + batch.beforeEach((done) => { fileRead = 0; fakeFS = { @@ -55,6 +55,10 @@ test('log4js configure', (batch) => { fs: fakeFS, }, }; + + if (typeof done === 'function') { + done(); + } }); batch.test( diff --git a/test/tap/connect-context-test.js b/test/tap/connect-context-test.js index f843222..ffd88dc 100644 --- a/test/tap/connect-context-test.js +++ b/test/tap/connect-context-test.js @@ -68,8 +68,11 @@ test('log4js connect logger', (batch) => { const ml = new MockLogger(); const cl = clm(ml, { context: true }); - t.beforeEach(() => { + t.beforeEach((done) => { ml.contexts = []; + if (typeof done === 'function') { + done(); + } }); t.test('response should be included in context', (assert) => { @@ -96,8 +99,11 @@ test('log4js connect logger', (batch) => { const ml = new MockLogger(); const cl = clm(ml, {}); - t.beforeEach(() => { + t.beforeEach((done) => { ml.contexts = []; + if (typeof done === 'function') { + done(); + } }); t.test('response should not be included in context', (assert) => { diff --git a/test/tap/connect-nolog-test.js b/test/tap/connect-nolog-test.js index a0b1e30..1d780a7 100644 --- a/test/tap/connect-nolog-test.js +++ b/test/tap/connect-nolog-test.js @@ -59,8 +59,11 @@ test('log4js connect logger', (batch) => { const ml = new MockLogger(); const cl = clm(ml, { nolog: '\\.gif' }); - t.beforeEach(() => { + t.beforeEach((done) => { ml.messages = []; + if (typeof done === 'function') { + done(); + } }); t.test('check unmatch url request', (assert) => { @@ -106,8 +109,11 @@ test('log4js connect logger', (batch) => { const ml = new MockLogger(); const cl = clm(ml, { nolog: '\\.gif|\\.jpe?g' }); - t.beforeEach(() => { + t.beforeEach((done) => { ml.messages = []; + if (typeof done === 'function') { + done(); + } }); t.test('check unmatch url request (png)', (assert) => { @@ -167,8 +173,11 @@ test('log4js connect logger', (batch) => { const ml = new MockLogger(); const cl = clm(ml, { nolog: ['\\.gif', '\\.jpe?g'] }); - t.beforeEach(() => { + t.beforeEach((done) => { ml.messages = []; + if (typeof done === 'function') { + done(); + } }); t.test('check unmatch url request (png)', (assert) => { @@ -228,8 +237,11 @@ test('log4js connect logger', (batch) => { const ml = new MockLogger(); const cl = clm(ml, { nolog: /\.gif|\.jpe?g/ }); - t.beforeEach(() => { + t.beforeEach((done) => { ml.messages = []; + if (typeof done === 'function') { + done(); + } }); t.test('check unmatch url request (png)', (assert) => { @@ -289,8 +301,11 @@ test('log4js connect logger', (batch) => { const ml = new MockLogger(); const cl = clm(ml, { nolog: [/\.gif/, /\.jpe?g/] }); - t.beforeEach(() => { + t.beforeEach((done) => { ml.messages = []; + if (typeof done === 'function') { + done(); + } }); t.test('check unmatch url request (png)', (assert) => { @@ -353,8 +368,11 @@ test('log4js connect logger', (batch) => { res.getHeader('content-type') === 'image/png' || res.statusCode < 400, }); - t.beforeEach(() => { + t.beforeEach((done) => { ml.messages = []; + if (typeof done === 'function') { + done(); + } }); t.test('check unmatch function return (statusCode < 400)', (assert) => { diff --git a/test/tap/logger-test.js b/test/tap/logger-test.js index a3eb738..62c5834 100644 --- a/test/tap/logger-test.js +++ b/test/tap/logger-test.js @@ -35,9 +35,12 @@ const testConfig = { }; test('../../lib/logger', (batch) => { - batch.beforeEach(() => { + batch.beforeEach((done) => { events.length = 0; testConfig.level = levels.TRACE; + if (typeof done === 'function') { + done(); + } }); batch.test('constructor with no parameters', (t) => { diff --git a/test/tap/multiprocess-test.js b/test/tap/multiprocess-test.js index b67aa55..7577b1d 100644 --- a/test/tap/multiprocess-test.js +++ b/test/tap/multiprocess-test.js @@ -51,8 +51,11 @@ function makeFakeNet() { } test('Multiprocess Appender', async (batch) => { - batch.beforeEach(() => { + batch.beforeEach((done) => { recording.erase(); + if (typeof done === 'function') { + done(); + } }); batch.test('worker', (t) => { diff --git a/test/tap/newLevel-test.js b/test/tap/newLevel-test.js index 4f58148..10714fe 100644 --- a/test/tap/newLevel-test.js +++ b/test/tap/newLevel-test.js @@ -3,8 +3,11 @@ const log4js = require('../../lib/log4js'); const recording = require('../../lib/appenders/recording'); test('../../lib/logger', (batch) => { - batch.beforeEach(() => { + batch.beforeEach((done) => { recording.reset(); + if (typeof done === 'function') { + done(); + } }); batch.test('creating a new log level', (t) => { diff --git a/test/tap/noLogFilter-test.js b/test/tap/noLogFilter-test.js index d52cf48..00fe6a3 100644 --- a/test/tap/noLogFilter-test.js +++ b/test/tap/noLogFilter-test.js @@ -6,8 +6,11 @@ const recording = require('../../lib/appenders/recording'); * test a simple regexp */ test('log4js noLogFilter', (batch) => { - batch.beforeEach(() => { + batch.beforeEach((done) => { recording.reset(); + if (typeof done === 'function') { + done(); + } }); batch.test(