react-browser-extension-boilerplate
react-browser-extension-boilerplate copied to clipboard
Add test configuration using Jest and RTL
I really liked this boilerplate, so I would to add some contribution if you agree. Here is my idea about tests:
Having a test configuration will allow us developers to build more consistent and "security" extensions with this boilerplate.
- [x] Add jest and RTL packages
- [x] Add config on
package.json
and also the scripts to run tests - [ ] Add coverage command and report
- [ ] Add tests description on README
I'm already working on this one, just need to fix a little problem with the coverage report, but let me know what you think about this please. Thank you.
@LucasAndrad Yeah, we definitely need some tests.
I like RTL. But I'm not sure if we can somehow mock browser API.
I need to perform some research.)
Good point, I didn't thought about it. I'll comment here if I find a solution for that.
Hey @ElForastero, there is a package to mock browser api, and works just fine: https://github.com/clarkbw/jest-webextension-mock
I'm facing some problems with @testing/preact. Is there an specific reason to use preact instead react? Just asking because I was able to test everything on my project after added react on it.
Also if you want to take a look, here is what I did so far: https://github.com/LucasAndrad/react-browser-extension-boilerplate/tree/add-test-setup
@LucasAndrad Great work 👍
I think we can switch the defaults from Preact to React.
Using Preact can really lead to some strange problems, and would be better to leave this at the discretion of the user.