@@ -5,6 +5,7 @@ import * as vscode from 'vscode';
55import { CancellationToken } from 'vscode-languageclient' ;
66import { parallelize , staggerProgress } from './helpers' ;
77import { cpus } from 'os' ;
8+ import { assert } from 'console' ;
89
910/**
1011 * TypeScript types to represent data from GNATcoverage XML reports
@@ -307,16 +308,24 @@ export async function addCoverageData(run: vscode.TestRun, covDir: string) {
307308 throw new vscode . CancellationError ( ) ;
308309 }
309310
310- const found = await vscode . workspace . findFiles (
311- `**/${ file [ '@_name' ] ! } ` ,
312- null ,
313- 1 ,
314- ) ;
315- if ( found . length == 0 ) {
316- return undefined ;
311+ assert ( file [ '@_name' ] ) ;
312+
313+ let srcUri : vscode . Uri ;
314+ if ( path . isAbsolute ( file [ '@_name' ] ! ) ) {
315+ srcUri = vscode . Uri . file ( file [ '@_name' ] ! ) ;
316+ } else {
317+ const found = await vscode . workspace . findFiles (
318+ `**/${ file [ '@_name' ] ! } ` ,
319+ null ,
320+ 1 ,
321+ ) ;
322+ if ( found . length == 0 ) {
323+ return undefined ;
324+ }
325+
326+ srcUri = found [ 0 ] ;
317327 }
318328
319- const srcUri = found [ 0 ] ;
320329 const total = file . metric . find (
321330 ( m ) => m [ '@_kind' ] == 'total_lines_of_relevance' ,
322331 ) ! [ '@_count' ] ;
@@ -325,7 +334,7 @@ export async function addCoverageData(run: vscode.TestRun, covDir: string) {
325334 ] ;
326335
327336 const fileReportBasename = data . coverage_report . sources ! [ 'xi:include' ] . find (
328- ( inc ) => inc [ '@_href' ] == `${ file [ '@_name' ] ! } .xml` ,
337+ ( inc ) => inc [ '@_href' ] == `${ path . basename ( file [ '@_name' ] ! ) } .xml` ,
329338 ) ! [ '@_href' ] ;
330339 const fileReportPath = path . join ( covDir , fileReportBasename ) ;
331340
0 commit comments