File tree 3 files changed +15
-1
lines changed
3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 36
36
},
37
37
"devDependencies" : {
38
38
"@types/chai" : " ^4.2.7" ,
39
- "@types/cheerio" : " ^ 0.22.10 " ,
39
+ "@types/cheerio" : " 0.22.22 " ,
40
40
"@types/finalhandler" : " ^1.1.0" ,
41
41
"@types/glob" : " ^7.1.3" ,
42
42
"@types/marked" : " ^1.2.0" ,
Original file line number Diff line number Diff line change @@ -173,6 +173,11 @@ export class LinkChecker extends EventEmitter {
173
173
const paths : string [ ] = [ ] ;
174
174
for ( const path of options . path ) {
175
175
const expandedPaths = await glob ( path ) ;
176
+ if ( expandedPaths . length === 0 ) {
177
+ throw new Error (
178
+ `The provided glob "${ path } " returned 0 results. The current working directory is "${ process . cwd ( ) } ".`
179
+ ) ;
180
+ }
176
181
paths . push ( ...expandedPaths ) ;
177
182
}
178
183
options . path = paths ;
Original file line number Diff line number Diff line change @@ -407,4 +407,13 @@ describe('linkinator', () => {
407
407
assert . ok ( results . passed ) ;
408
408
assert . strictEqual ( results . links . length , 3 ) ;
409
409
} ) ;
410
+
411
+ it ( 'should throw if a glob provides no paths to scan' , async ( ) => {
412
+ await assert . rejects (
413
+ check ( {
414
+ path : 'test/fixtures/basic/*.md' ,
415
+ } ) ,
416
+ / r e t u r n e d 0 r e s u l t s /
417
+ ) ;
418
+ } ) ;
410
419
} ) ;
You can’t perform that action at this time.
0 commit comments