swc-plugin-coverage-instrument icon indicating copy to clipboard operation
swc-plugin-coverage-instrument copied to clipboard

Incomplete instrumentation for method as class property

Open nil-s-s opened this issue 9 months ago • 1 comments

Following class is incompletely covered, the code in propertyFunction is not covered, only the assignment:

class Testing {
    method() {
        return 'Hello, World! ' + this.propertyFunction();
    }

    propertyFunction = () => {
        return 'Instance';
    };
}

export { Testing };

This is the resulting report. Line 7 is not covered by instrumentation.

Image

nil-s-s avatar Feb 14 '25 09:02 nil-s-s

Similar to https://github.com/kwonoj/swc-plugin-coverage-instrument/issues/247#issuecomment-2397605287, I'm open to accept a PR.

kwonoj avatar Feb 19 '25 06:02 kwonoj

I managed to build a local git clone with the change and paste the wasm file into the node_modules for our app. The cases that were not instrumented before now look good now!

nil-s-s avatar Jul 23 '25 14:07 nil-s-s