Skip to content

Commit 9a946cd

Browse files
committed
fix: boron node version test failures
1 parent 8bd9777 commit 9a946cd

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

lib/db.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ Db.prototype.collection = function(name, options, callback) {
440440
}
441441

442442
// Merge in all needed options and ensure correct writeConcern merging from db level
443-
options = conditionallyMergeWriteConcern(options, this.s.options, COLLECTION_OPTION_KEYS, true);
443+
options = conditionallyMergeWriteConcern(options, this.s.options);
444444

445445
// Execute
446446
if (options == null || !options.strict) {

lib/utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,9 @@ function decorateWithExplain(command, explain) {
534534
}
535535

536536
const emitProcessWarning = msg =>
537-
process.emitWarning(msg, { type: 'DeprecationWarning', code: MONGODB_WARNING_CODE });
537+
+process.version[1] <= 6
538+
? process.emitWarning(msg, 'DeprecationWarning', MONGODB_WARNING_CODE)
539+
: process.emitWarning(msg, { type: 'DeprecationWarning', code: MONGODB_WARNING_CODE });
538540
// eslint-disable-next-line no-console
539541
const emitConsoleWarning = msg => console.error(msg);
540542
const emitDeprecationWarning = process.emitWarning ? emitProcessWarning : emitConsoleWarning;

test/functional/deprecate_warning.test.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,16 @@ describe('Deprecation Warnings', function() {
7171
.trim();
7272

7373
// ensure warning message matches expected
74-
expect(warning).to.equal(
75-
'[MONGODB DRIVER] DeprecationWarning: testDeprecationFlags option [maxScan]' +
76-
defaultMessage
77-
);
74+
if (+process.version[1] <= 6) {
75+
expect(warning).to.equal(
76+
'DeprecationWarning: testDeprecationFlags option [maxScan]' + defaultMessage
77+
);
78+
} else {
79+
expect(warning).to.equal(
80+
'[MONGODB DRIVER] DeprecationWarning: testDeprecationFlags option [maxScan]' +
81+
defaultMessage
82+
);
83+
}
7884

7985
// ensure each following line is from the stack trace, i.e. 'at config.deprecatedOptions.forEach.deprecatedOption'
8086
split.pop();

0 commit comments

Comments
 (0)