react-modal icon indicating copy to clipboard operation
react-modal copied to clipboard

Replace Karma (now deprecated) with a new test runner

Open doeg opened this issue 1 year ago • 6 comments

React Modal uses Karma as its test runner. Karma, however, was deprecated in April 2023.

It looks like the recommended migration is to Jest and Web Test Runner as described here.

@diasbruno noted some caveats specific to React Modal over in https://github.com/reactjs/react-modal/issues/1036:

I thought of moving the test system to jest, but we need to run on the browser as we have a few trick bits to have more reliable tests (to detect hidden node and other things).

If we do move to SWC (as proposed in https://github.com/reactjs/react-modal/issues/1036) and Jest, it's worth noting that SWC has a drop-in replacement that's supposedly much faster than Jest. Given that this repo is fairly small, it may not be super relevant to us... but good to know nonetheless!

doeg avatar Feb 10 '24 16:02 doeg

Another thing worth mentioning is that Assitiv Labs, which offers comprehensive and accessibility-focused end-to-end testing, is free for open source projects. I've had really good experiences working with them. :)

I don't think this would be a replacement for unit tests with Jest (or whichever Karma alternative we go with) so I won't go into too much detail on this issue... but I did want to mention it!

doeg avatar Feb 10 '24 16:02 doeg

jsdom (used by jest) is ok for basic simulations of DOM and rendering, but it's better to use a real browser.

I guess any test runner that can run on the browser is fine.

diasbruno avatar Feb 10 '24 20:02 diasbruno

@diasbruno it looks like Web Test Runner, which is recommended (by that Angular post above) for migration off of Karma (along with Jest for unit tests, presumably), supports real browsers: https://modern-web.dev/docs/test-runner/browser-launchers/overview/

Perhaps that would be the best place to start, and if/when a need for Jest presents itself, then we can add it to the testing tooclhain. :)

doeg avatar Feb 10 '24 23:02 doeg

I was trying to get "jasmine-browser-runner" to work, but I was also giving up on it. I'll check it out.

diasbruno avatar Feb 11 '24 00:02 diasbruno

@diasbruno let me know if I can do anything to be helpful! ☺️

doeg avatar Feb 11 '24 00:02 doeg

Before we tackle this, we (I mean I) need to finish the build system. I did some progress on that, only need to build the pre-compiled lib and the examples.

diasbruno avatar Feb 22 '24 19:02 diasbruno