File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 window ,
77 workspace ,
88 WorkspaceFolder ,
9+ Uri
910} from "vscode" ;
1011
1112import { Config } from "../extension/config" ;
@@ -22,7 +23,7 @@ export class Coverage {
2223 * Displays the quick picker vscode modal and lets the user choose a file path
2324 * Note: if only one path is given it will return early and not prompt.
2425 */
25- public async pickFile ( filePaths : string [ ] | string , placeHolder : string ) : Promise < string | undefined > {
26+ public async pickFile ( filePaths : string [ ] | string , placeHolder : string ) : Promise < Uri | undefined > {
2627 let pickedFile : string | undefined ;
2728 if ( typeof filePaths === "string" ) {
2829 pickedFile = filePaths ;
@@ -47,7 +48,7 @@ export class Coverage {
4748
4849 pickedFile = item . description ;
4950 }
50- return pickedFile ;
51+ return pickedFile ? Uri . file ( pickedFile ) : undefined ;
5152 }
5253
5354 public findReports ( ) : Promise < string [ ] > {
Original file line number Diff line number Diff line change @@ -63,22 +63,22 @@ suite("Coverage Tests", () => {
6363 expect ( stubWarningMessage . calledWith ( "Did not choose a file!" ) ) ;
6464 } ) ;
6565
66- test ( "#pickFile: Should return string if filePaths is a string @unit" , async ( ) => {
66+ test ( "#pickFile: Should return vscode.uri if filePaths is a string @unit" , async ( ) => {
6767 const coverage = new Coverage (
6868 stubConfig ,
6969 ) ;
7070
7171 const value = await coverage . pickFile ( "123" , "nope" ) ;
7272
73- expect ( value ) . to . equal ( "123" ) ;
73+ expect ( value ?. path ) . to . equal ( "/ 123" ) ;
7474 } ) ;
7575
76- test ( "#pickFile: Should return string if filePaths is an array with one value @unit" , async ( ) => {
76+ test ( "#pickFile: Should return vscode.uri if filePaths is an array with one value @unit" , async ( ) => {
7777 const coverage = new Coverage (
7878 stubConfig ,
7979 ) ;
8080
8181 const value = await coverage . pickFile ( [ "123" ] , "nope" ) ;
82- expect ( value ) . to . equal ( "123" ) ;
82+ expect ( value ?. path ) . to . equal ( "/ 123" ) ;
8383 } ) ;
8484} ) ;
You can’t perform that action at this time.
0 commit comments