feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
feature: template coverage
Template Coverage
This addon supports branch coverage for Glimmer/Handlebars templates (.hbs files and <template> tags in .gjs/.gts files). When COVERAGE=true, templates are automatically instrumented during compilation to track which branches are executed.
What is tracked
How it works
A Glimmer AST plugin runs at build time and:
The coverage data integrates seamlessly with the existing Istanbul pipeline, appearing in the same HTML/LCOV/JSON reports alongside JavaScript coverage.
Setup for .hbs files
No additional setup is needed. The AST plugin is registered automatically via setupPreprocessorRegistry when the addon is installed. Branch coverage for .hbs files works out of the box.
Setup for .gjs/.gts files (strict mode)
For .gjs/.gts files using <template> tags, coverage helpers need to be in JavaScript scope. The buildBabelPlugin() method already includes a Babel plugin that injects the necessary imports automatically. No extra configuration is required if you already have buildBabelPlugin() in your ember-cli-build.js.