sszczep / chrome-extension-webpack

Get started with Chrome extensions development using webpack, TypeScript, Sass, and more.
MIT License
286 stars 47 forks source link

Added a simple test suite using `mocha` #2

Closed NikkelM closed 1 year ago

NikkelM commented 1 year ago

I recently migrated my existing project to use webpack and found your boilerplate quite useful for this transition. However, I ran into some unexpected problems when I tried to get my test suite running with this new environment, which turned out to be mostly because of a missing "type": "module" in the package.json, which I found is not very clear when first looking at the problem. To maybe prevent others from also falling into this trap, I added some very basic boilerplate for tests, so feel free to add this to the existing template if you find it to be useful.

sszczep commented 1 year ago

Hey @NikkelM, sorry for such a late reply.

Thanks for your PR. LGTM, will double check it in upcoming days and probably merge.

NikkelM commented 1 year ago

Thanks @sszczep for the review and noticing the issues with indentation, I've fixed those. I also thought it might be nice to provide a simple Github Actions workflow to run the tests when pushing to main or opening a PR against main, so I've added a .yml for that - if you think this goes too far and want to keep the boilerplate smaller, we can remove that again. You can see how that workflow looks and runs here in my fork.

sszczep commented 1 year ago

Looks good to me. I think it is a great addition to that project. From what it seems the workflow misses dependencies caching, however, it is not a problem for now. All of those things were on my todo-list but I had to abandon that project for some time. I am willing to release a new version introducing CRA-like tooling:

unfortunately, I couldn't find time for that yet.

Once again thank you for your contribution and keeping the project alive 🎇