2
2
const common = require ( '../common' ) ;
3
3
const assert = require ( 'assert' ) ;
4
4
const fs = require ( 'fs' ) ;
5
+ const cbTypeError = / ^ T y p e E r r o r : " c a l l b a c k " a r g u m e n t m u s t b e a f u n c t i o n $ / ;
5
6
6
7
function test ( cb ) {
7
8
return function ( ) {
@@ -26,13 +27,13 @@ process.once('warning', common.mustCall((warning) => {
26
27
assert . doesNotThrow ( test ( ) ) ;
27
28
28
29
function invalidArgumentsTests ( ) {
29
- assert . throws ( test ( null ) ) ;
30
- assert . throws ( test ( true ) ) ;
31
- assert . throws ( test ( false ) ) ;
32
- assert . throws ( test ( 1 ) ) ;
33
- assert . throws ( test ( 0 ) ) ;
34
- assert . throws ( test ( 'foo' ) ) ;
35
- assert . throws ( test ( / f o o / ) ) ;
36
- assert . throws ( test ( [ ] ) ) ;
37
- assert . throws ( test ( { } ) ) ;
30
+ assert . throws ( test ( null ) , cbTypeError ) ;
31
+ assert . throws ( test ( true ) , cbTypeError ) ;
32
+ assert . throws ( test ( false ) , cbTypeError ) ;
33
+ assert . throws ( test ( 1 ) , cbTypeError ) ;
34
+ assert . throws ( test ( 0 ) , cbTypeError ) ;
35
+ assert . throws ( test ( 'foo' ) , cbTypeError ) ;
36
+ assert . throws ( test ( / f o o / ) , cbTypeError ) ;
37
+ assert . throws ( test ( [ ] ) , cbTypeError ) ;
38
+ assert . throws ( test ( { } ) , cbTypeError ) ;
38
39
}
0 commit comments