@@ -14,9 +14,9 @@ describe('anymatch', function() {
14
14
}
15
15
] ;
16
16
it ( 'should resolve string matchers' , function ( ) {
17
- assert . equal ( true , anymatch ( matchers , 'path/to/file.js' ) ) ;
18
- assert . equal ( true , anymatch ( matchers [ 0 ] , 'path/to/file.js' ) ) ;
19
- assert . equal ( false , anymatch ( matchers [ 0 ] , 'bar.js' ) ) ;
17
+ assert ( anymatch ( matchers , 'path/to/file.js' ) ) ;
18
+ assert ( anymatch ( matchers [ 0 ] , 'path/to/file.js' ) ) ;
19
+ assert ( ! anymatch ( matchers [ 0 ] , 'bar.js' ) ) ;
20
20
} ) ;
21
21
it ( 'should resolve glob matchers' , function ( ) {
22
22
assert . equal ( true , anymatch ( matchers , 'path/anyjs/baz.js' ) ) ;
@@ -38,8 +38,8 @@ describe('anymatch', function() {
38
38
} ) ;
39
39
it ( 'should ignore improperly typed matchers' , function ( ) {
40
40
var emptyObj = { } ;
41
- assert . equal ( false , anymatch ( emptyObj , emptyObj ) ) ;
42
- assert . equal ( false , anymatch ( Infinity , Infinity ) ) ;
41
+ assert . equal ( false , anymatch ( emptyObj , '' ) ) ;
42
+ assert . equal ( false , anymatch ( Infinity , '' ) ) ;
43
43
} ) ;
44
44
45
45
describe ( 'with returnIndex = true' , function ( ) {
@@ -58,7 +58,10 @@ describe('anymatch', function() {
58
58
} ) ;
59
59
60
60
describe ( 'curried matching function' , function ( ) {
61
- var matchFn = anymatch ( matchers ) ;
61
+ var matchFn ;
62
+ before ( ( ) => {
63
+ matchFn = anymatch ( matchers ) ;
64
+ } ) ;
62
65
it ( 'should resolve matchers' , function ( ) {
63
66
assert . equal ( true , matchFn ( 'path/to/file.js' ) ) ;
64
67
assert . equal ( true , matchFn ( 'path/anyjs/baz.js' ) ) ;
@@ -91,46 +94,46 @@ describe('anymatch', function() {
91
94
} ) ;
92
95
} ) ;
93
96
94
- describe ( 'using matcher subsets' , function ( ) {
95
- it ( 'should skip matchers before the startIndex' , function ( ) {
96
- assert ( anymatch ( matchers , 'path/to/file.js' , false ) ) ;
97
- assert ( ! anymatch ( matchers , 'path/to/file.js' , false , 1 ) ) ;
98
- } ) ;
99
- it ( 'should skip matchers after and including the endIndex' , function ( ) {
100
- assert ( anymatch ( matchers , 'path/to/bars.js' , false ) ) ;
101
- assert ( ! anymatch ( matchers , 'path/to/bars.js' , false , 0 , 3 ) ) ;
102
- assert ( ! anymatch ( matchers , 'foo.js' , false , 0 , 1 ) ) ;
103
- } ) ;
104
- } ) ;
97
+ // describe('using matcher subsets', function() {
98
+ // it('should skip matchers before the startIndex', function() {
99
+ // assert(anymatch(matchers, 'path/to/file.js', false));
100
+ // assert(!anymatch(matchers, 'path/to/file.js', false, 1));
101
+ // });
102
+ // it('should skip matchers after and including the endIndex', function() {
103
+ // assert(anymatch(matchers, 'path/to/bars.js', false));
104
+ // assert(!anymatch(matchers, 'path/to/bars.js', false, 0, 3));
105
+ // assert(!anymatch(matchers, 'foo.js', false, 0, 1));
106
+ // });
107
+ // });
105
108
106
109
describe ( 'extra args' , function ( ) {
107
- it ( 'should allow string to be passed as first member of an array' , function ( ) {
108
- assert ( anymatch ( matchers , [ 'path/to/bar.js' ] ) ) ;
109
- } ) ;
110
- it ( 'should pass extra args to function matchers' , function ( ) {
111
- matchers . push ( function ( string , arg1 , arg2 ) { return arg1 || arg2 ; } ) ;
112
- assert ( ! anymatch ( matchers , 'bar.js' ) , 1 ) ;
113
- assert ( ! anymatch ( matchers , [ 'bar.js' , 0 ] ) , 2 ) ;
114
- assert ( anymatch ( matchers , [ 'bar.js' , true ] ) , 3 ) ;
115
- assert ( anymatch ( matchers , [ 'bar.js' , 0 , true ] ) , 4 ) ;
116
- // with returnIndex
117
- assert . equal ( anymatch ( matchers , [ 'bar.js' , 1 ] , true ) , 4 , 5 ) ;
118
- // curried versions
119
- var matchFn1 = anymatch ( matchers ) ;
120
- var matchFn2 = anymatch ( matchers [ 4 ] ) ;
121
- assert ( ! matchFn1 ( [ 'bar.js' , 0 ] ) , 6 ) ;
122
- assert ( ! matchFn2 ( [ 'bar.js' , 0 ] ) , 7 ) ;
123
- assert ( matchFn1 ( [ 'bar.js' , true ] ) , 8 ) ;
124
- assert ( matchFn2 ( [ 'bar.js' , true ] ) , 9 ) ;
125
- assert ( matchFn1 ( [ 'bar.js' , 0 , true ] ) , 10 ) ;
126
- assert ( matchFn2 ( [ 'bar.js' , 0 , true ] ) , 11 ) ;
127
- // curried with returnIndex
128
- assert . equal ( matchFn1 ( [ 'bar.js' , 1 ] , true ) , 4 , 12 ) ;
129
- assert . equal ( matchFn2 ( [ 'bar.js' , 1 ] , true ) , 0 , 13 ) ;
130
- assert . equal ( matchFn1 ( [ 'bar.js' , 0 ] , true ) , - 1 , 14 ) ;
131
- assert . equal ( matchFn2 ( [ 'bar.js' , 0 ] , true ) , - 1 , 15 ) ;
132
- matchers . pop ( ) ;
133
- } ) ;
110
+ it ( 'should not allow string to be passed as first member of an array' , function ( ) {
111
+ assert . throws ( ( ) => anymatch ( matchers , [ 'path/to/bar.js' ] ) ) ;
112
+ } ) ;
113
+ // it('should pass extra args to function matchers', function() {
114
+ // matchers.push(function(string, arg1, arg2) { return arg1 || arg2; });
115
+ // assert(!anymatch(matchers, 'bar.js'), 1);
116
+ // assert(!anymatch(matchers, ['bar.js', 0]), 2);
117
+ // assert(anymatch(matchers, ['bar.js', true]), 3);
118
+ // assert(anymatch(matchers, ['bar.js', 0, true]), 4);
119
+ // // with returnIndex
120
+ // assert.equal(anymatch(matchers, ['bar.js', 1], true), 4, 5);
121
+ // // curried versions
122
+ // var matchFn1 = anymatch(matchers);
123
+ // var matchFn2 = anymatch(matchers[4]);
124
+ // assert(!matchFn1(['bar.js', 0]), 6);
125
+ // assert(!matchFn2(['bar.js', 0]), 7);
126
+ // assert(matchFn1(['bar.js', true]), 8);
127
+ // assert(matchFn2(['bar.js', true]), 9);
128
+ // assert(matchFn1(['bar.js', 0, true]), 10);
129
+ // assert(matchFn2(['bar.js', 0, true]), 11);
130
+ // // curried with returnIndex
131
+ // assert.equal(matchFn1(['bar.js', 1], true), 4, 12);
132
+ // assert.equal(matchFn2(['bar.js', 1], true), 0, 13);
133
+ // assert.equal(matchFn1(['bar.js', 0], true), -1, 14);
134
+ // assert.equal(matchFn2(['bar.js', 0], true), -1, 15);
135
+ // matchers.pop();
136
+ // });
134
137
} ) ;
135
138
136
139
describe ( 'glob negation' , function ( ) {
0 commit comments