Open apowers313 opened 9 years ago
If coverage for JavaScript in HTML doesn't already exist, maybe one way of adding it would be to create a <tested-script>
web component that could be used in place of <script>
tags, where<tested-script>
would instrument the code inside that tag.
I'm not sure if Istanbul can instrument code in the browser, or if the only instrumenting codes exist on the command line.
Any thoughts?
I just created my own package that provides the facilities for instrumenting the JavaScript in HTML: html-script-hook
For examples of how to use it with Istanbul, see the README or check out this example.
Hopefully it will be useful to others that find themselves in the same position.
+1
+1
New web component technologies, such as Polymer, advocate for embedding the majority of JavaScript inside the web components that they are attached to.
Is there a preprocessor or any other way to generate code coverage information for JavaScript that is embedded in HTML files?
See also: thedeeno/web-component-tester-istanbul#12