waku-org / js-waku

JavaScript implementation of Waku v2
https://js.waku.org
Apache License 2.0
169 stars 42 forks source link

feat: move to jest #1144

Open weboko opened 1 year ago

weboko commented 1 year ago
This is a **change request** ## Problem Right now `@waku/*` projects more or less follow the same testing stack/approach: - mocha, karma, chai for the stack; - run tests in headless Chrome; ## Proposed Solutions I think it is better for us to move to jest due to various factors: - all-in-one lib (no need to configure additionally if something is needed such as spy lib); - seamless local experience; - easy to configure browser like environment; - configurable with puppeteer; ## Notes One of the features I'd like to unlock by introducing `jest` is opportunity to test in different browsers. In case of Chrome there are no problems, but if Firefox or some other browser is our goal - we will have to choose automated testing approach and use Cypress or similar solution such as Browser Stack. Before going deep into integrating testing with other browsers I'd like to take a step back and point out goals of it: - make sure library is interpretable by different browsers; - library is run the same way in different browsers; I think that we can cover those cases in a *good enough* way by: - defining list of supported browsers; - using polyfills; - setting build system in a way it targets supported browsers; - running tests in a browser like (or Chrome) environment; This list is based on the fact that we are speaking about JS library and assumption that the only thing that can work differently within various browsers is API used and not transformed properly (no polyfill e.g). Related PRs: https://github.com/waku-org/js-rln/pull/45 cc: @fryorcraken
fryorcraken commented 1 year ago

using polyfills

I don't think any of the current stack use polyfills.

make sure library is interpretable by different browsers;

It's possible to do with Karma

Right now @waku/* projects more or less follow the same testing stack/approach:

mocha, karma, chai for the stack; run tests in headless Chrome;

The problem statement seems to be more a description of the current stack. Could you be more specific on the gains we would have in migrating to jest? I expect the migration to be costly and hence I just want to ensure we have a high ROI for this change.

danisharora099 commented 1 year ago

I propose to move this to triage/todo in reference to https://github.com/waku-org/js-waku/issues/1523

danisharora099 commented 1 year ago

moving this back to icebox -- not relevant for now; we can revisit this if we find a use-case