Commit graph

2 commits

Author SHA1 Message Date
joakin e6081106f1 Use EcmaScript modules instead of common.js modules
Why: Because they are the approved standard by TC39 and Ecma for
JavaScript modules.

Changes:
  * Wrap mw-node-qunit in run.js to register babel to transpile modules
    for node v6
  * Change all sources in src/ to use ES modules
    * Change constants.js to be able to run without
      jQuery.bracketedDevicePixelRatio given ES modules are hoisted to
      the top by spec so we can't patch globals before importing it
  * Change all tests in tests/node-qunit/ to use ES modules
  * Drop usage of mock-require given ES modules are easy to stub with
    sinon

Additional changes:
  * Rename tests/node-qunit/renderer.js to renderer.test.js to follow
    the convention of all the other files
  * Make npm run test:node run only .test.js test files so that it
    doesn't run the stubs.js or run.js file.

Bug: T171951
Change-Id: I17a0b76041d5e2fd18e2d54950d9d7c0db99a941
2017-07-31 23:05:44 +00:00
joakin 33c05394f4 Set up qunit running in node to migrate tests to commonjs
In order to run qunit tests on sources that use common.js modules, set
up infra to run qunit tests in the node cli when running:

    npm run test:node

Changes:
* Add npm script test:node that runs the tests
* Run node tests on CI (npm test)
* Add a qunit node test runner: mw-node-qunit
* Migrate a test from the root hierarchy and another one from the nested
  one to prove it works (globs fail otherwise)
  * reducers/settings.test.js to node qunit to prove it works
  * counts.test.js to node qunit to prove it works

Change-Id: I55d76b7db168f3745e0ac69852c152322ab385c3
2017-02-20 20:01:01 +01:00