File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,9 @@ class Query {
213
213
this . filters . push ( propertyOrFilter ) ;
214
214
return this ;
215
215
} else {
216
+ process . emitWarning (
217
+ 'Providing Filter objects is recommended when using .filter'
218
+ ) ;
216
219
let operator = operatorOrValue as Operator ;
217
220
if ( arguments . length === 2 ) {
218
221
value = operatorOrValue as { } ;
Original file line number Diff line number Diff line change @@ -164,6 +164,17 @@ describe('Query', () => {
164
164
assert . strictEqual ( filter . op , '=' ) ;
165
165
assert . strictEqual ( filter . val , 'Stephen' ) ;
166
166
} ) ;
167
+
168
+ it ( 'should issue a warning when a Filter instance is not provided' , done => {
169
+ new Query ( [ 'kind1' ] ) . filter ( 'name' , 'Stephen' ) ;
170
+ process . on ( 'warning' , warning => {
171
+ assert . strictEqual (
172
+ warning . message ,
173
+ 'Providing Filter objects is recommended when using .filter'
174
+ ) ;
175
+ done ( ) ;
176
+ } ) ;
177
+ } ) ;
167
178
} ) ;
168
179
169
180
describe ( 'filter with Filter class' , ( ) => {
You can’t perform that action at this time.
0 commit comments