Skip to content

Commit c442bda

Browse files
committed
Add a test to check if a warning is emitted
1 parent a87d5da commit c442bda

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

test/cliff-test.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,34 @@
55
*
66
*/
77

8+
// When using cliff with winston 0.8.x in node 14.x a warning is emitted:
9+
//
10+
// Warning: Accessing non-existent property 'padLevels' of module exports
11+
// inside circular dependency
12+
//
13+
// The warning is emitted when we require'd cliff, which happens before any
14+
// test, so in order to test that a warning is *not* emitted we have to capture
15+
// it before requiring cliff.
16+
var warnings = [];
17+
process.on('warning', function(warning) {
18+
warnings.push(warning);
19+
});
20+
821
var assert = require('assert'),
922
vows = require('vows'),
1023
eyes = require('eyes'),
1124
cliff = require('../lib/cliff');
1225

1326
vows.describe('cliff').addBatch({
27+
"When require cliff module": {
28+
"no warning should be raised": function () {
29+
var rows = [
30+
["a", "b"],
31+
];
32+
cliff.putRows('info', rows, ['red', 'green']);
33+
assert.isEmpty(warnings);
34+
},
35+
},
1436
"When using cliff module": {
1537
"the columnMajor() method": {
1638
"should respond with rows in column major form": function () {
@@ -76,4 +98,4 @@ vows.describe('cliff').addBatch({
7698
}
7799
}
78100
}
79-
}).export(module);
101+
}).export(module);

0 commit comments

Comments
 (0)