Skip to content

Coverage for GTS files is inaccurate #417

@elwayman02

Description

@elwayman02

This may or may not be related to #407, except that issue has a fix and I've tested with the fixed version of ember-cli-code-coverage to confirm the issue I'm reporting.

To make sure I had this addon set up correctly, I followed the documented steps for ember-cli-build.js in the readme:

  • sourceMaps are set to inline
  • babel plugin is set up
  • sourcemaps is enabled and set to JS extension
  • ember-template-imports inline_source_map config is enabled

Then, running the tests and checking the coverage output showed that when a component is a GTS file (with a GJS integration test file), the coverage % is lower than when it's converted back to separate TS/HBS files (with a JS integration test file).

One gts file I checked has a coverage output of {"lines":{"total":11,"covered":2,"skipped":0,"pct":18.18}.
The same file converted to separate ts/hbs files now has an output of {"lines":{"total":11,"covered":3,"skipped":0,"pct":27.27}.

Another one:
GTS - {"lines":{"total":5,"covered":1,"skipped":0,"pct":20}
TS - {"lines":{"total":5,"covered":2,"skipped":0,"pct":40}

While GTS files are in fact being output in coverage reports now, the numbers are not accurate, and that's artificially lowering test coverage compared to using classic Ember file formats. This likely also impacts GJS files, though I did not explicitly test it.

Tested in both v2.1.2 and v3.0.0 of ember-cli-code-coverage

Here's a snapshot of some other possibly relevant dependency versions:

  • ember-source: 4.12.3
  • ember-cli: 4.12.2
  • ember-template-imports: 3.4.2
  • ember-cli-babel: 7.26.11
  • typescript: 5.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions