File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -464,12 +464,22 @@ describe("pathToFsPath", () => {
464464 it ( "should keep drive letter casing when set to true" , ( ) => {
465465 expect ( util . pathToFsPath ( "/C:/far/bo" , true ) ) . toBe ( "C:/far/bo" )
466466 } )
467- it ( "should throw an error if an array is passed in for path" , ( ) => {
468- // @ts -expect-error We need to make sure it throws when an array is passed in.
469- expect ( ( ) => util . pathToFsPath ( [ ] ) ) . toThrow (
470- `Could not computer fsPath from given uri. Expected path to be of type string, but was of type object.` ,
467+ it ( "should throw an error if a non-string is passed in for path" , ( ) => {
468+ expect ( ( ) =>
469+ util
470+ // @ts -expect-error We need to check other types
471+ . pathToFsPath ( { } ) ,
472+ ) . toThrow (
473+ `Could not computer fsPath from given uri. Expected path to be of type string, but was of type undefined.` ,
471474 )
472475 } )
476+ it ( "should not throw an error for a string array" , ( ) => {
477+ // @ts -expect-error We need to check other types
478+ expect ( ( ) => util . pathToFsPath ( [ "/hello/foo" , "/hello/bar" ] ) . not . toThrow ( ) )
479+ } )
480+ it ( "should use the first string in a string array" , ( ) => {
481+ expect ( util . pathToFsPath ( [ "/hello/foo" , "/hello/bar" ] ) ) . toBe ( "/hello/foo" )
482+ } )
473483 it ( "should replace / with \\ on Windows" , ( ) => {
474484 let ORIGINAL_PLATFORM = process . platform
475485
You can’t perform that action at this time.
0 commit comments