mozilla / extension-workshop

Firefox Extension Workshop
https://extensionworkshop.com
99 stars 131 forks source link

Add unit tests for all JavaScript #158

Open muffinresearch opened 5 years ago

muffinresearch commented 5 years ago

Any JavaScript that is applied to the site should have unit tests.

Once we have some tests these can be run by CI on every commit.

muffinresearch commented 4 years ago

We now have jest as a test runner and there's an example of how to configure tests here: https://github.com/mozilla/extension-workshop/blob/05e973ed368075e6d260690ffa1035e3a11aa171/tests/new-tab-links.test.js

This approach can be used for individual files.

For example the newsletter sign-up script would be a good one to start with.