Basic code coverage tests for WebExtensions

RESOLVED FIXED

Status

WebExtensions
Untriaged
RESOLVED FIXED
3 years ago
4 days ago

People

(Reporter: kmag, Assigned: kmag)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
It would be nice to have some basic code coverage tests for WebExtensions. There's been some work to add broad JS code coverage tests to mozilla-central, but it looks like that's still a long way off.

I've looked at a few tools, and it looks like, of the widely-used options, this will probably be the easiest one to adapt to our test environment:

https://github.com/gotwarlost/istanbul
(Assignee)

Comment 1

3 years ago
Created attachment 8682284 [details] [diff] [review]
coverage-wip.diff
(Assignee)

Comment 2

3 years ago
So far, the coverage is much better than I expected:

https://people.mozilla.org/~kmaglione/webextension-text-coverage/

The attached patch is a bit of a hack, so I'm not going to try to land id. I may try to land a cleaner version later on. To make this work, I manually instrumented the web extension scripts in my objdir, and then generated a report from the output files after running the webextension tests.
Blocks: 1185459
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
(Assignee)

Comment 3

3 years ago
Looks like bug 1191289 and bug 1204554 may give us a better option for a longer term solution.
(Assignee)

Updated

3 years ago
Depends on: 1224961

Updated

4 days ago
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.