karma-runner / karma-runner/karma-coverage

Code coverage: how to cover code in <script> tag in html files?

Open
#277 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
771
Forks
242
PR merge metrics
No merged PRs in 30d

Description

Hello,

I am working with lots of html files, each of them containing tags.

I am testing these, and they are working correctly.

But, the code coverage is reporting nothing about theses files. And I would like them to do so.

Html files are about (they are polymerjs component):
```
<dom-module name="epc-catched-network-request">
<script>
.. code to be tested against code-coverage ..

```

In my karma.conf.js, I have this code:

```
...
preprocessors: {
'framework/*.js': [ 'coverage' ],
'framework/*.html': [ 'coverage' ],
'framework/!(bower_components)/**/*.js': [ 'coverage' ],
'framework/!(bower_components)/**/*.html': [ 'coverage' ],
},
...
```

Any clue on how to have some code coverage report taking code in this tags?

Contributor guide

Open the contributing guide

Research direction

Start with the karma.conf.js preprocessors shown in the issue and reproduce coverage for the framework/*.html and framework/!(bower_components)/**/*.html patterns. Inspect how coverage handles JavaScript embedded in HTML, then define completion as coverage output that includes the code inside the component’s tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.