* workflows: Rename "CI" to "Release"
Rename this to make space for a separate "CI" workflow that will
run continuous integration and testing jobs for commits and PRs.
* workflows: add CI workflow for unit tests and support running locally
* Load qunit package from npm, this is the start of a larger transition.
ref at https://github.com/kiwix/kiwix-js/issues/554.
* Update QUnit from 2.3 to 2.13.
* Use Karma for the running of unit tests (instead of Nightwatch).
While it was possible to use a fake "UI" test to open the QUnit
web page with Nightwatch, this had numerous limitations:
- relies on fragile and unsupported DOM scraping to collect
test results, which breaks between framework versions.
ref https://github.com/kiwix/kiwix-js/pull/660.
- severely limits debugging information for failing tests.
- cannot easily be reproduced or debugged locally from the command-line
as the Nightwatch config was pinned to Sauce Labs, and creating
a local configuration is not easy because Nightwatch has a hard
requirement for installing and running a WebDriver server.
People usually do not have this installed and it's non-trivial
to set up and keep working in the long term, and across multiple
different software projects.
- cannot easily be run in a secure container separate from your
personal computer, thus putting personal data at risk.
- lacks wider integration and plugins to enrich unit testing,
such as test coverage reports.
Using Karma means:
- We can run 'npm test' locally during development and have it
automatically run the tests in headless Firefox and Chrome
and report back, all from the command-line.
- The same exact same stack is also used in CI with SauceLabs
for additional browser coverage (same as before).
- It has no external dependencies other than the plain web
browser itself. This means if you have a development container
(e.g. based on Docker) that has Node.js + Firefox + Chromium,
you can run the tests there without exposing anything from
your personal computer, besides the current directory.
<https://timotijhof.net/posts/2019/protect-yourself-from-npm/>
- In a future change, we can plug in karma-coverage to generate
a test coverage report, to submit to Codecov or Coveralls.
ref https://github.com/kiwix/kiwix-js/issues/528.
* I have pinned the version of 'http-server' and 'nightwatch'
in package.json so that these don't silently upgrade in a way
that may introduce security issues or drop compatibility for
the environment we currently support.
Fixes https://github.com/kiwix/kiwix-js/issues/653.
* Re-enable unit and UI tests in latest Edge
The tests were disabled after https://github.com/kiwix/kiwix-js/pull/499
due to an issue with the Edge version that was the default "edge" on
SauceLabs in May 2019 (not sure which version that was, the last pre-Chromium
Edge version was 44, which was passing, so perhaps SauceLabs defaulted
to a beta release, or used a much older version like 15-18?)
Now that Edge uses Chromium, try re-enabling the tests.
Fixes https://github.com/kiwix/kiwix-js/issues/502.
Follows-up 0c530101573cf95b, which removed this from www/index.html,
but it was still present in the test suite.
This is now loaded automatically by RequireJS.