melonjs / melonJS

a fresh, modern & lightweight HTML5 game engine
https://melonjs.org
MIT License
5.92k stars 643 forks source link

[Feature request] move to a more es6 friendly test unit framework #1130

Closed obiot closed 2 years ago

obiot commented 2 years ago

melonJS currently use Jasmine (with Karma) in a es5 mode, which is the only reason why we still have a es5 build as part of the main melonJS branch (with the move to es6, and the boilerplate offering a transpiring option, there is no reason to keep maintaining a es5 build)

Jasmine does not support es6 natively, the only way around is to use babel or other to transpile the code dynamically before running the test suite.

therefore, the natural choice is to move to a new framework, for example jest, as it seems to be the most popular choice : https://www.testim.io/blog/best-unit-testing-framework-for-javascript/

Jest 5 steps tutorial: https://www.testim.io/blog/jest-testing-a-helpful-introductory-tutorial/

Migration guide to Jest (from Jasmine) https://jestjs.io/docs/migration-guide

[EDIT] After playing with Jest, I'm not really convinced, as from what I saw it's more built for testing under a node environment than a browser, so moving on with Mocha (#2 in the list) for the next round of testing before actually choosing a replacement !

obiot commented 2 years ago

@L1lith this one is done !!! thanks again for your huge help on this one, as all I did was to finish porting the test and some minor clean up.