Closed
Description
#547 addresses a related issue.
(other related: aurelia/testing#94)
Problem
What I found, is that the instrumented code (maybe special to this lib @jsdevtools/coverage-istanbul-loader
) is using methods instead of simple properties
⚠️ There is a bug when parsing code, that has coverage-helper-code.
More specifically, aurelia-validation does not parse the helper code correctly aurelia/testing#94.
I found a fix, but would need to PR to the aurelia repo and stuff.
(Maybe we just fork ourselves, will create a ticket)
function (a) {
- cov_2n0ovlwwxg.f[2]++; // "normally"
+ cov_2n0ovlwwxg().f[2]++; // maybe only @jsdevtools/coverage-istanbul-loader?
return a.message;
}
Suggested fix
A fix I found is to update the parts of the regex by including ()
(open and close paren)
export function getAccessorExpression(fn: string): string {
/* tslint:disable:max-line-length */
- const classic = /^function\s*\([$_\w\d]+\)\s*\{(?:\s*"use strict";)?(?:[$_\s\w\d\/\*.['"\]+;]+)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/;
+ const classic = /^function\s*\([$_\w\d]+\)\s*\{(?:\s*"use strict";)?(?:[$_\s\w\d\/\*.['"\]+();]+)?\s*return\s+[$_\w\d]+\.([$_\w\d]+)\s*;?\s*\}$/;
^ actual change here
Keywords:
@jsdevtools/coverage-istanbul-loader
code coverage instrumented code
Metadata
Metadata
Assignees
Labels
No labels