[openstreetmap/openstreetmap-website] Re-enable javascript unit tests (#2595)

Andy Allan notifications at github.com
Wed Jan 4 16:00:04 UTC 2023


I've had a look at this today, with partial success. Some notes:

* I thought it might be possible to run the mocha/chai tests directly, i.e. keep everything in the nodejs ecosystem and avoid any integration with rails. But due to the use of compiled assets needed for the code under test, that's definitely swimming against the tide. So I've looked into alternatives to konacha (last commit 2016).
* The requirements are that the test framework has some level of rails integration (to get the assets from app/javascripts, vendor/assets, etc all pulled together easily) and can run mocha tests with chai assertions.
* https://github.com/jejacks0n/teaspoon fits the bill, although that was last updated in early 2021. I've [got a branch which works locally](https://github.com/gravitystorm/openstreetmap-website/tree/teaspoon), but I haven't yet got it working on github-ci.
* [jasmine-rails](https://github.com/searls/jasmine-rails) has been deprecated (2020) and so has the [Jasmine ruby gem](https://github.com/jasmine/jasmine-gem) (2022), but these were apparently in popular use after the konacha era. The suggested replacement for these is running the nodejs version of jasmine. That's rather like point 1 though, but also requires refactoring the tests away from mocha/chai.

If anyone has any suggestions then I'm all ears!

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2595#issuecomment-1371111340
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/2595/1371111340 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230104/1411c6ed/attachment.htm>


More information about the rails-dev mailing list