Skip to content

Commit

Permalink
Add a test to check if a warning is emitted
Browse files Browse the repository at this point in the history
  • Loading branch information
Terseus committed Jan 29, 2022
1 parent 51c7694 commit 20c241e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion test/cliff-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,34 @@
*
*/

// When using cliff with winston 0.8.x in node 14.x a warning is emitted:
//
// Warning: Accessing non-existent property 'padLevels' of module exports
// inside circular dependency
//
// The warning is emitted when we require'd cliff, which happens before any
// test, so in order to test that a warning is *not* emitted we have to capture
// it before requiring cliff.
var warnings = [];
process.on('warning', function(warning) {
warnings.push(warning);
});

var assert = require('assert'),
vows = require('vows'),
eyes = require('eyes'),
cliff = require('../lib/cliff');

vows.describe('cliff').addBatch({
"When require cliff module": {
"no warning should be raised": function () {
var rows = [
["a", "b"],
];
cliff.putRows('info', rows, ['red', 'green']);
assert.isEmpty(warnings);
},
},
"When using cliff module": {
"the columnMajor() method": {
"should respond with rows in column major form": function () {
Expand Down Expand Up @@ -76,4 +98,4 @@ vows.describe('cliff').addBatch({
}
}
}
}).export(module);
}).export(module);

0 comments on commit 20c241e

Please sign in to comment.