1- import { DeclarationCoverage , Position , Range , StatementCoverage , TextDocument , Uri , workspace } from 'vscode'
1+ import { DeclarationCoverage , Position , Range , StatementCoverage , TestRun , TextDocument , Uri , workspace } from 'vscode'
22import { PropathParser } from 'ABLPropath'
33import { ABLDebugLines } from 'ABLDebugLines'
44import { log } from 'ChannelLogger'
@@ -18,7 +18,7 @@ export class ABLProfile {
1818 profJSON ?: ABLProfileJson
1919 parseAll = false
2020
21- async parseData ( uri : Uri , writeJson : boolean , debugLines ?: ABLDebugLines , ignoreExternalCoverage = true , propath ?: PropathParser ) {
21+ async parseData ( uri : Uri , options : TestRun , writeJson : boolean , debugLines ?: ABLDebugLines , ignoreExternalCoverage = true , propath ?: PropathParser ) {
2222 if ( ! debugLines ) {
2323 // unit testing setup
2424 debugLines = new ABLDebugLines ( )
@@ -46,7 +46,7 @@ export class ABLProfile {
4646 }
4747
4848 log . debug ( 'section1 ' + sectionLines [ 1 ] . length )
49- this . profJSON = new ABLProfileJson ( uri , sectionLines [ 1 ] , debugLines , ignoreExternalCoverage )
49+ this . profJSON = new ABLProfileJson ( options , uri , sectionLines [ 1 ] , debugLines , ignoreExternalCoverage )
5050 log . debug ( 'section2 ' + sectionLines [ 2 ] . length )
5151 this . profJSON . addModules ( sectionLines [ 2 ] )
5252 if ( this . profJSON . modules . length > 0 ) { // all modules excluded
@@ -308,7 +308,11 @@ export class ABLProfileJson {
308308 ignoredModules : number [ ] = [ 0 ]
309309 private hasSourceMap = false
310310
311- constructor ( public readonly profileUri : Uri , lines : string [ ] , public debugLines : ABLDebugLines , private readonly ignoreExternalCoverage : boolean ) {
311+ constructor ( private readonly options : TestRun ,
312+ public readonly profileUri : Uri ,
313+ lines : string [ ] ,
314+ public debugLines : ABLDebugLines ,
315+ private readonly ignoreExternalCoverage : boolean ) {
312316 this . parseDuration = new Duration ( 'parse profile data: ' + profileUri )
313317 this . debugLines = debugLines
314318 if ( lines . length > 1 ) {
@@ -467,6 +471,13 @@ export class ABLProfileJson {
467471 async addSourceMap ( ) {
468472 for ( const mod of this . modules ) {
469473 const map = await this . debugLines . getSourceMap ( mod . SourceUri ) . then ( ( sourceMap ) => {
474+
475+ if ( sourceMap ?. crc && sourceMap . crc != mod . CrcValue ) {
476+ log . warn ( 'crc mismatch for module ' + mod . ModuleName + ' in uri=' + this . profileUri . fsPath + ' (ModuleID=' + mod . ModuleID + ')' +
477+ '\n\t- expected: ' + mod . CrcValue +
478+ '\n\t- got: ' + sourceMap . crc , { testRun : this . options } )
479+ }
480+
470481 return sourceMap
471482 } , ( e : unknown ) => {
472483 log . error ( 'could not get source map for module ' + mod . ModuleName + ' in uri=' + this . profileUri . fsPath + ' (ModuleID=' + mod . ModuleID + ') - ' + e )
0 commit comments