Description
@gorhill I'm not sure if this is something you're interested in, but here is my proposal for unit testing: https://github.com/geoffdutton/uBlock/tree/unit-tests-proposal
Here is the current diff: https://github.com/gorhill/uBlock/compare/master...geoffdutton:unit-tests-proposal?expand=1
I've written a few test cases, and would be happy to contribute more. I think it can help for two main reasons:
- Preventing regressions
- Refactoring code and trying performance improvements
Number 2 is especially nice, such as when parsing new filter syntaxes or running extreme scenarios.
I'd be happy to go into more detail on how to write tests, when to mock functions, how to mimic browser features, etc. I chose jest
because it's fast, and you can mimic any browser like here.
Let me know if this is something you're interested in incorporating.