Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test configuration using Jest and RTL #14

Open
2 of 4 tasks
LucasAndrad opened this issue May 24, 2020 · 4 comments
Open
2 of 4 tasks

Add test configuration using Jest and RTL #14

LucasAndrad opened this issue May 24, 2020 · 4 comments

Comments

@LucasAndrad
Copy link
Contributor

LucasAndrad commented May 24, 2020

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.

  • Add jest and RTL packages
  • 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.

@ElForastero
Copy link
Owner

ElForastero commented May 25, 2020

@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.)

@LucasAndrad
Copy link
Contributor Author

Good point, I didn't thought about it. I'll comment here if I find a solution for that.

@LucasAndrad
Copy link
Contributor Author

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

@ElForastero
Copy link
Owner

@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.

@ElForastero ElForastero mentioned this issue Feb 24, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants