diff --git a/src/query.ts b/src/query.ts index be125935e..17011c4f4 100644 --- a/src/query.ts +++ b/src/query.ts @@ -213,6 +213,9 @@ class Query { this.filters.push(propertyOrFilter); return this; } else { + process.emitWarning( + 'Providing Filter objects is recommended when using .filter' + ); let operator = operatorOrValue as Operator; if (arguments.length === 2) { value = operatorOrValue as {}; diff --git a/test/entity.ts b/test/entity.ts index d9348a144..e967b7667 100644 --- a/test/entity.ts +++ b/test/entity.ts @@ -770,10 +770,12 @@ describe('entity', () => { "' property is outside of bounds of a JavaScript Number.\n" + "Use 'Datastore.int()' to preserve accuracy during the upload."; - process.on('warning', warning => { + const onWarning = (warning: {message: unknown}) => { assert.strictEqual(warning.message, expectedWarning); + process.removeListener('warning', onWarning); done(); - }); + }; + process.on('warning', onWarning); entity.encodeValue(largeIntValue, property); });