-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert QUnit tests to mocha #1187
Comments
Hey, @Jaifroid. Would you like me to take this up? If yes, let me know if you have any existing ideas for this migration. BTW, I got busy with work earlier, so couldn't continue on my previous issue, would like to work on something now. |
@gaurava05 That would be great! I don't have any preconceived ideas for the migration. We currently run Unit tests in a sort of quirky way, in browser context (for legacy reasons). They really just need to run in Node context, ideally without QUnit and using an industry-standard framework instead (I suggest Mocha, because it's already used in the Repo for Selenium-based e2e tests). The idea is to ditch QUnit and Testcafé (the automation framework that only QUnit tests are run in) entirely. It will mean rewriting each test. Currently, QUnit tests are run without compiling the code, i.e. they are run directly on the raw codebase. I'm agnostic about whether it's better to run them after compiling to dist ( You can see the existing code in E2E tests are (of course) run on compiled code (using browser automation). But this issue wouldn't need to touch that testing code, as it's currently (more or less) stable and running well on Browser Stack. |
Hey @Jaifroid,
Here's the link to the fork in which I've made the changes: https://github.com/rishabhdwivedii/kiwix-js The changes I've made so far:
Can you guide me on how to deal with the Image reference error. |
@rishabhdwivedii Thanks for having a go at this. You seem to be attempting to access the scripts over the file:// protocol, which won't work. You need to spin up a local server like http-server (included in the Repo if you did npm install). I'm afraid I don't know exactly how mocha works (testcafe includes its own server, or at least its test scripts start a server for you), so you'll need to check exactly what's needed to run tests in mocha. |
Since we already use mocha for assertion in e2e tests, it would make sense to use it in Unit tests also. We currently run Unit tests in UI-based framework (QUnit) that runs directly in browsers, and as a result we have to run them in a browser-testing suite (testcafe) instead of directly in a Node framework like mocha. This adds overhead and is counterintuitive. It is also confusing, because there seems to be some blurring of lines between Unit and e2e testing.
I think it's time to drop QUnit.
The text was updated successfully, but these errors were encountered: