Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Code coverage off by 2 lines in components with co-located template

Open
#779 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
testing-qa

Research direction

Start with a coverage report for a component with a co-located template and compare it with the generated source described here. Use related pull requests #558 and #763 for context. Done means the injected import and template constant no longer shift reported source lines or count as source coverage.

Written by the indexing model from the issue text.

Description

In components with a co-located template, the plugin adds import { hbs } and const __COLOCATED_TEMPLATE__ = ... to the source file, and that is affecting the code coverage. Not only does this affect the percentage itself, as const __COLOCATED_TEMPLATE__ = ... is seen as a line that is covered without it being part of the source code, it also makes it very difficult to look at a coverage report as the lines are off by 2 (see screenshot)

In https://github.com/ember-cli/ember-cli-htmlbars/pull/558 and https://github.com/ember-cli/ember-cli-htmlbars/pull/763, something similar is addressed, but then just for source maps which appeared to be resolved without the fixes. However, for the code coverage this is still relevant, and placing the lines at the end would at least solve the off-by-2 issues (would have been fun if it was the typical off-by-1 error 😄)

image

Dominant language
JavaScript
Stars
77
Forks
65
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ember-cli/ember-cli-htmlbars

All issues in ember-cli/ember-cli-htmlbars

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.