Commit graph

1142 commits

Author SHA1 Message Date
jenkins-bot 1797f4eb7e Merge "Test: Migrate wait.test.js to node-qunit" 2017-02-22 23:18:52 +00:00
jenkins-bot 9883cd8fc7 Merge "Tests: Up the min version of the node qunit runner" 2017-02-22 23:13:10 +00:00
Translation updater bot bdafa3c686 Localisation updates from https://translatewiki.net.
Change-Id: I75686f684797eda5e4bf77438ac752f3b0d4fa2b
2017-02-22 22:44:38 +01:00
Sam Smith 61b4e70dea tests: Actually run QUnit tests
I225019b8 introduced a regression where empty Resource Loader modules,
i.e. modules without any scripts, were being added in the
ResourceLoaderTestModules handler because the base directory wasn't
being calculated properly.

Change-Id: I25b01b2b5a4fe78e5c784eeba25bdaec37198abf
2017-02-22 12:01:12 +00:00
joakin 8e78005b30 Tests: Migrate previewBehavior.test.js to node qunit
Additional changes:
* Mock global usage of mw.Title.newFromText().getUrl

Change-Id: Idcabea0f996f481194d1b6ecbea6f9f63b253bc6
2017-02-22 12:14:07 +01:00
joakin fb4649d469 Tests: Migrate settingsDialog.test.js to node qunit
Additional changes:
* Mock usage of global mw.{msg,template,config}

Change-Id: I67e5cdd5bb275b9083eae0df80af2195c41a7f8e
2017-02-22 12:14:07 +01:00
joakin 4f71f6f740 Tests: Migrate gateway/rest.test.js to node qunit
Additional changes:
* Fix eslint errors in the test file
* Mock global mw.Title usage in the test

Change-Id: Ia2778457239184639150d03ab0f0a1ca597a862e
2017-02-22 12:14:07 +01:00
joakin 2ca5fed3ee Tests: Migrate changeListeners/render.test.js to node-qunit
The render change listener is hard coupled to the renderer file, so in
order to migrate the test, instead of stubbing a global variable, we had
to either inject the renderer into the change listener factory as done
everywhere else, or mock the require call.

In order to do one thing per commit, we're mocking the require call
here to get the migration done, but added a FIXME to use dependency
injection instead in a future change.

Change-Id: I50f82cdc9664d34b8a8ccc1ff368f7209404159d
2017-02-22 12:14:05 +01:00
joakin 4e0c054a19 Tests: Migrate changeListeners/syncUserSettings.test.js to node-qunit
Change-Id: I3bf86e0452557e938fe7066978e553d583d974f7
2017-02-22 12:13:38 +01:00
joakin 715389443c Tests: Migrate changeListeners/linkTitle.test.js to node-qunit
Change-Id: I714b8737d61ce3db35852ceb977449c709002537
2017-02-22 12:13:38 +01:00
joakin 010502b9b1 Tests: Migrate changeListeners/footerLink.test.js to node-qunit
Given this is a jsdom environment assertions using jQuery's :visible
have been changed to check the display property for visibility.

See https://github.com/tmpvar/jsdom/issues/1048

Change-Id: Ifad8067c0b50053a94ac977ee1f1f5a3066bfa16
2017-02-22 12:13:37 +01:00
joakin 48988e30da Tests: Migrate gateway/mediawiki.test.js to node-qunit
Change-Id: Ia47b0f793430b355eb2e39d74a05e72ea55de0b1
2017-02-22 12:13:37 +01:00
joakin 30550e2670 Test: Migrate wait.test.js to node-qunit
Don't use fake timers for now because of some problems with other async
tests.

Change-Id: If48a8c7390416938d50c9c0c39539fe4a6a9a6af
2017-02-22 12:13:37 +01:00
joakin 8a2f19d593 Tests: Up the min version of the node qunit runner
It has important improvements, and we don't want dev to use a previous
version.

List of changes on the runner:
* 1.0.6 Add globals to window too
* 1.0.5 Don't reorder or run tests in parallel
* 1.0.4 Don't autostart the tests, they are manually started
* 1.0.3 Invoke sandbox restore after hooks have been called
* 1.0.2 Default fake timers and server to false

See https://github.com/joakin/mw-node-qunit/commits/master

Change-Id: Ic3283c99eb374bc9f85c703ef0b55f875d527e0b
2017-02-22 12:13:34 +01:00
jenkins-bot e9012c1fcd Merge "Add Factories ADR" 2017-02-22 10:50:45 +00:00
Sam Smith 58ab7345fb Add Factories ADR
During the review of I71a8a848, it was noted that there was no
documentation/ADR about the use of factories over classes.

Change-Id: I29ab44b3f9c680c81fbddebc7844bd05e26f18df
2017-02-22 11:46:45 +01:00
Translation updater bot c5559d971c Localisation updates from https://translatewiki.net.
Change-Id: I1321997e0335d3f72b83b537c74a326c0a2c4887
2017-02-21 22:49:34 +01:00
jenkins-bot e885755f8e Merge "Test: Migrate changeListeners/settings.test.js to node-qunit" 2017-02-21 20:41:33 +00:00
jenkins-bot 68cd0a330d Merge "Test: Migrate eventLoggingChangeListener.test.js to node-qunit" 2017-02-21 20:41:22 +00:00
jenkins-bot c6ccf9dddf Merge "Test: Migrate changeListener.test.js to node-qunit" 2017-02-21 20:39:29 +00:00
jenkins-bot 0971543bde Merge "Test: Migrate isEnabled.test.js to node-qunit" 2017-02-21 20:37:13 +00:00
jenkins-bot 1b367df9ae Merge "Test: Migrate preview/model.test.js to node-qunit" 2017-02-21 20:36:02 +00:00
jenkins-bot d19c5701f9 Merge "Test: Migrate reducers/eventLogging.test.js to node-qunit" 2017-02-21 20:33:28 +00:00
jenkins-bot 51f39da9d3 Merge "Test: Migrate reducers/preview.test.js to node-qunit" 2017-02-21 20:30:21 +00:00
jenkins-bot 5e12cdaece Merge "Set up qunit running in node to migrate tests to commonjs" 2017-02-21 20:19:23 +00:00
Piotr Miazga 6a1948d729 Hygiene: Use CommonJS in gateway/rest.js
Changes:
 - removed unnecessary IIFE closure

Change-Id: Ic91c29d9d5e09573145c8667a6a941233b91b3fd
2017-02-21 17:57:08 +00:00
Translation updater bot b190a17cea Localisation updates from https://translatewiki.net.
Change-Id: I9ae6fcaa253b91aef70633abae4e9011cbce7c0a
2017-02-20 23:52:18 +01:00
joakin 620c97c53d Test: Migrate changeListeners/settings.test.js to node-qunit
Change-Id: Ic7651133ee2ac6eee68d30b3c7069c26da1abf8b
2017-02-20 20:01:01 +01:00
joakin 600b21182d Test: Migrate eventLoggingChangeListener.test.js to node-qunit
And on the way there actually put it in a changeListeners/ folder and
rename it to eventLogging.test.js

Change-Id: I60685021841b44f606f39b07bf7f5262344262f4
2017-02-20 20:01:01 +01:00
joakin d2d7ab10fa Test: Migrate changeListener.test.js to node-qunit
Change-Id: Ib6d5156d2f1bc56c113866ed0510966586d9ca07
2017-02-20 20:01:01 +01:00
joakin f3839189dc Test: Migrate isEnabled.test.js to node-qunit
Change-Id: I85a08725c9138f47a51cdc34c20bc3a60b61af34
2017-02-20 20:01:01 +01:00
joakin c233ffb4a5 Test: Migrate preview/model.test.js to node-qunit
Change-Id: Ie5a895a1760dbfc58e11369fdb8b979021b8ae74
2017-02-20 20:01:01 +01:00
joakin b7a4029adb Test: Migrate reducers/eventLogging.test.js to node-qunit
Change-Id: I4bc6d77a496a8c4bf1ecafbf3a6a71986c77e423
2017-02-20 20:01:01 +01:00
joakin d06bbe5871 Test: Migrate reducers/preview.test.js to node-qunit
Change-Id: I700bc43dace64503058337a6b458673070bc5db0
2017-02-20 20:01:01 +01: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
joakin 78cb95cda2 Hygiene: Remove unnecessary IIFE and use proper requires
In index.js. Instead of using the global variable/object popups, require
things from their files so that we can remove the global variables when
we can run qunit tests with commonjs in node.

Change-Id: I85408f01eca27f97cf46b2076176fcc16c037829
2017-02-20 18:39:51 +01:00
joakin f1e6e2bfa1 Hygiene: Remove unnecessary IIFE in gateway/mediawiki.js
Change-Id: If6d76c2915b13f9871dea3b7f33cb74ec5906566
2017-02-20 18:39:49 +01:00
joakin 0260325bb9 Hygiene: Remove unnecessary IIFE in schema.js
Change-Id: Ic152668ff7e4c96fb63934283897a51e81e58dd4
2017-02-20 18:39:47 +01:00
joakin 5fc46b4cdd Hygiene: Remove unnecessary IIFE in renderer.js
Change-Id: I89a1ac2205385db8e2f2c040ac22d2f4de793a18
2017-02-20 18:39:45 +01:00
joakin 2c1a30e35e Hygiene: Remove unnecessary IIFE in processLinks.js
Change-Id: Icd6ab0a9b0a189c19310915cb77f861459aecddf
2017-02-20 18:39:42 +01:00
joakin d54cfc2e42 Hygiene: Remove unnecessary IIFE in previewBehavior.js
Change-Id: I4f6f4094ba545f827dad28e966d69e6ecec3cea2
2017-02-20 18:39:33 +01:00
jenkins-bot 7b86981054 Merge "Hygiene: Remove unnecessary IIFE in checkin.js" 2017-02-20 17:31:01 +00:00
jenkins-bot 8097314077 Merge "Hygiene: Remove unnecessary IIFE in changeListeners/render.js" 2017-02-20 17:30:03 +00:00
jenkins-bot cafe6d4edb Merge "Hygiene: Remove unnecessary IIFE in changeListeners/linkTitle.js" 2017-02-20 17:30:01 +00:00
jenkins-bot b6c49825c5 Merge "Hygiene: Remove unnecessary IIFE in changeListeners/footerLink.js" 2017-02-20 17:30:01 +00:00
jenkins-bot 319c04ce2f Merge "Hygiene: Remove unnecessary IIFE in changeListeners/eventLogging.js" 2017-02-20 17:23:35 +00:00
jenkins-bot 0199fc782a Merge "Hygiene: Remove useless IIFE in settingsDialog.js" 2017-02-20 17:19:35 +00:00
jenkins-bot ef78e27571 Merge "Hygiene: Remove unnecessary IIFE in wait.js" 2017-02-20 17:19:34 +00:00
jenkins-bot f0bac7a4fa Merge "Hygiene: Remove unnecessary IIFE in actions.js" 2017-02-20 17:19:33 +00:00
Translation updater bot 8868f05c34 Localisation updates from https://translatewiki.net.
Change-Id: I10aa08a217a5255ab7cf76a035ee7331853ffc5b
2017-02-19 22:41:54 +01:00