diff --git a/test/model.watch.test.js b/test/model.watch.test.js index 612bb84a75..099101e764 100644 --- a/test/model.watch.test.js +++ b/test/model.watch.test.js @@ -56,6 +56,9 @@ describe('model: watch: ', function() { assert.strictEqual(readyCalled, false); await close; + // Change stream may still emit "MongoAPIError: ChangeStream is closed" because change stream + // may still poll after close. + changeStream.on('error', () => {}); }); it('watch() close() closes the stream (gh-7022)', async function() { @@ -75,6 +78,9 @@ describe('model: watch: ', function() { const closedData = await closed; assert.strictEqual(closedData, true); + // Change stream may still emit "MongoAPIError: ChangeStream is closed" because change stream + // may still poll after close. + changeStream.on('error', () => {}); }); }); });