File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export const jrefMediaTypePlugin = {
9
9
anchorLocation : anchorLocation
10
10
} ;
11
11
} ,
12
- fileMatcher : ( path ) => path . endsWith ( ". jref" )
12
+ fileMatcher : ( path ) => / [ ^ / ] \. j r e f $ / . test ( path )
13
13
} ;
14
14
15
15
const anchorLocation = ( fragment ) => decodeURI ( fragment || "" ) ;
Original file line number Diff line number Diff line change @@ -52,6 +52,23 @@ foo: 42
52
52
}
53
53
} ) ;
54
54
55
+ it ( "/.jref is not a JRef file" , async ( ) => {
56
+ const path = `${ fixtureDirectory } /.jref` ;
57
+ const jref = `
58
+ foo: 42
59
+ ` ;
60
+
61
+ await writeFile ( fileURLToPath ( `${ testUri } /${ path } ` ) , jref ) ;
62
+
63
+ try {
64
+ await get ( path ) ;
65
+ expect . fail ( "Expected RetrievalError => UnknownMediaTypeError" ) ;
66
+ } catch ( error : unknown ) {
67
+ expect ( error ) . to . be . instanceof ( RetrievalError ) ;
68
+ expect ( ( error as RetrievalError ) . cause . name ) . to . equal ( "UnknownMediaTypeError" ) ;
69
+ }
70
+ } ) ;
71
+
55
72
describe ( "http context" , ( ) => {
56
73
let browser : Browser ;
57
74
You can’t perform that action at this time.
0 commit comments