@@ -10,8 +10,8 @@ const testLogFixturesPath = path.join(__dirname, '..', '..', '..', 'fixtures', '
10
10
11
11
const { MESSAGE } = require ( 'triple-beam' ) ;
12
12
13
- function removeFixtures ( ) {
14
- rimraf ( path . join ( testLogFixturesPath , 'test*' ) , { glob : true } ) ;
13
+ async function removeFixtures ( ) {
14
+ await rimraf ( path . join ( testLogFixturesPath , 'test*' ) , { glob : true } ) ;
15
15
}
16
16
function getFilePath ( filename ) {
17
17
return path . join ( testLogFixturesPath , filename ) ;
@@ -55,16 +55,15 @@ describe('File Transport', function () {
55
55
const logPayload = { level : 'info' , [ MESSAGE ] : kbStr } ;
56
56
transport . log ( logPayload ) ;
57
57
}
58
- await new Promise ( resolve => setTimeout ( resolve , 50 ) ) ;
58
+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
59
59
}
60
- beforeEach ( ( ) => {
61
- removeFixtures ( ) ;
60
+
61
+ beforeEach ( async ( ) => {
62
+ await removeFixtures ( ) ;
62
63
} ) ;
63
64
64
65
afterEach ( async ( ) => {
65
- removeFixtures ( ) ;
66
- // Allow time for file system operations to complete
67
- await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
66
+ await removeFixtures ( ) ;
68
67
} ) ;
69
68
70
69
describe ( 'Filename Option' , function ( ) {
@@ -92,8 +91,6 @@ describe('File Transport', function () {
92
91
93
92
await logKbytesToTransport ( transport , 4 ) ;
94
93
95
- await new Promise ( resolve => setTimeout ( resolve , 50 ) ) ;
96
-
97
94
assertFileExists ( 'testarchive.log' ) ;
98
95
assertFileExists ( 'testarchive_.log' ) ;
99
96
} ) ;
@@ -151,9 +148,6 @@ describe('File Transport', function () {
151
148
await logKbytesToTransport ( transport , 4 , 'B' ) ;
152
149
await logKbytesToTransport ( transport , 4 , 'C' ) ;
153
150
154
- // Give file system operations time to complete archiving
155
- await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
156
-
157
151
// Verify the expected files exist and their contents are correct
158
152
assertFileExists ( 'testarchive.log' ) ;
159
153
assertFileExists ( 'testarchive1.log' ) ;
@@ -164,7 +158,7 @@ describe('File Transport', function () {
164
158
assertFileContentsStartWith ( 'testarchive.log' ) ;
165
159
assertFileContentsStartWith ( 'testarchive1.log' , 'C' ) ;
166
160
assertFileContentsStartWith ( 'testarchive2.log' , 'B' ) ;
167
- // TODO : I would expect the first file that was rolled to be filled with the first log message
161
+ // FIX : I would expect the first file that was rolled to be filled with the first log message
168
162
// assertFileContentsStartWith('testarchive3.log', 'A');
169
163
} ) ;
170
164
@@ -179,9 +173,6 @@ describe('File Transport', function () {
179
173
await logKbytesToTransport ( transport , 4 , 'B' ) ;
180
174
await logKbytesToTransport ( transport , 4 , 'C' ) ;
181
175
182
- // Give file system operations time to complete archiving
183
- await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
184
-
185
176
// Verify the expected files exist
186
177
assertFileExists ( 'testarchive.log' ) ;
187
178
assertFileExists ( 'testarchive1.log' ) ;
@@ -190,7 +181,7 @@ describe('File Transport', function () {
190
181
191
182
// Verify the contents of the files are in the expected order
192
183
assertFileContentsStartWith ( 'testarchive.log' ) ;
193
- // TODO : only two of the files are filled and are not in the expected order
184
+ // FIX : only two of the files are filled and are not in the expected order
194
185
// assertFileContentsStartWith('testarchive1.log', 'A');
195
186
// assertFileContentsStartWith('testarchive2.log', 'B');
196
187
// assertFileContentsStartWith('testarchive3.log', 'C');
@@ -232,7 +223,7 @@ describe('File Transport', function () {
232
223
} ) ;
233
224
234
225
235
- // TODO: Rewrite these tests in mocha
226
+ // TODO: Reintroduce these tests
236
227
//
237
228
// "Error object in metadata #610": {
238
229
// topic: function () {
0 commit comments