Commit graph

249 commits

Author SHA1 Message Date
Ed Sanders
4fc3f3af24 build: Update eslint-config-wikimedia to 0.17.0
Fix remaining instances of variable shadowing.

Change-Id: I2a3840446f1fe138410249cc35be5ddf262d8e46
2020-08-20 12:45:09 +01:00
Nikki Nikkhoui
c26d64fc18 UserContributions endpoint add tags 'display' property
Add a property to the 'tags' object in the /user/{name}/contributions
REST endpoint named 'display' which shows the display
HTML for the tag which is either defined in i18n .json
files or overriden at MediaWiki:tag-$name

Bug: T259716
Depends-On: I57e2a7253944a3fde3f52f52bbf5fe8473c8a415
Change-Id: Id755adcab8b0115e19df2a6046643ebe97881e28
2020-08-19 06:04:50 -07:00
Nikki Nikkhoui
7452d8c067 REST /me/contributions: return change tags
The endpoint for user contributions should include change tags in the
result. Bump the version of npm module api-testing.

Bug: T252202
Change-Id: Iccc0c378bc65d0f34b38557f4c78f424d95a951f
2020-06-25 19:28:02 +02:00
Ed Sanders
ceb2cd2fe8 build: Update eslint-config-wikimedia to 0.16.2
Use jsduck config.

Change-Id: I3a1a0c8f0ca535c9661b3774498866fdb98a4255
2020-06-18 19:12:10 +00:00
Ed Sanders
08510de602 api-testing: Use wikimedia/mocha eslint config
Change-Id: Iec346d87f252c66fbff1e0fa522d7440df6f1764
2020-06-18 19:20:33 +01:00
alqaholic007
eed975d6e3 Selenium: Use wdio-video-reporter for recording test videos
Earlier versions of WebdriverIO lacked support for video recording.
Starting with WebdriverIO v5, a new package wdio-video-reporter
has been introduced which is used to replace ffmpeg and Xvfb.

Limitations:
- Alert messages and pop-ups do not get displayed in the videos.

New Packages:
- wdio-video-reporter

Bug: T255253
Change-Id: Id443779959bfac55eae42e16e10d1f20c25375bb
2020-06-15 13:32:02 +02:00
daniel
5ac84ffd12 REST /me/contributions: return revisions
This is part of a chain of patches to complete the REST User Contributions
endpoint. This change returns a list of the 2 (hard-coded for now) most
recent revisions for a given user.

Package.json was also updated for new api-testing module (v 1.1.0)

Bug: T252202
Change-Id: I42a5dfc0e1ff7600848e89ac2c4b002e8a3612df
2020-06-09 08:19:45 -07:00
Ed Sanders
8b720e9bd6 eslint: Update to eslint-config-wikimedia 0.16.0
* valid-jsdoc replaced with jsdoc plugin
* New /selenium config

Change-Id: I471eebac0312cb25c539c3f6a3ecfc7cfd4ed8d6
2020-06-02 21:32:56 +01:00
vidhi-mody
19ba555c71 Selenium: Update to WebdriverIO v6
Update NPM packages: @wdio/* and webdriverio.

Bug: T253306
Change-Id: Id073b4924a00af2078117191d27ba9443dbb67ec
2020-05-21 13:57:40 +00:00
Zfilipin
157a1e3829 Revert "Selenium: Use wdio-video-reporter to record videos of test run"
This reverts commit babbbbc6e5.

Reason for revert: Video recording only works with WebdriverIO v5. It doesn't work with v6.

Bug: T252523
Change-Id: I5dd0bb5ef03bcf5337207c63d26755e983634787
2020-05-20 10:37:09 +00:00
AlQaholic007
babbbbc6e5 Selenium: Use wdio-video-reporter to record videos of test run
Earlier versions of WebdriverIO lacked support for video recording.
Starting with WebdriverIO v5, a new package wdio-video-reporter
has been introduced which is used to replace ffmpeg and Xvfb.

Limitations:
- Alert messages and pop-ups do not get displayed in the videos.

Bug: T252523
Change-Id: I6c964467066eb30e28a3435ddf7831a4e296b8f5
2020-05-14 19:24:10 +02:00
James D. Forrester
31fbff8914 build: Upgrade karma-related devDependencies to latest
grunt-karma  3.0.2  →   4.0.0
 karma        4.4.1  →   5.0.4
 karma-qunit  4.0.0  →   4.1.0

Change-Id: I4e91df8076ab190d8655833c94332ca09f3efaa6
2020-05-04 13:54:20 -07:00
James D. Forrester
591ece50e0 build: Upgrade all regular linters to latest
Change-Id: Iab677e4c6c842b6a4d3fdd48f8b5d361d8acf365
2020-05-04 13:51:45 -07:00
James D. Forrester
9a868a0b99 resources: Upgrade qunit from 2.9.3 to 2.10.0
Change-Id: Ib0a0ab2465946fbedf120ebb506a038c526fc78e
2020-05-04 13:49:51 -07:00
Roan Kattouw
bed84e3281 build: Provide linting for .vue files from upstream
Was first attempted in f1eaa06d5e,
and reverted in 0b3fe4fe8c. Now this
is done in eslint-config-wikimedia for all repos.

Change-Id: I9ee735eef40085b6373b565838d67e186e438657
2020-04-15 17:40:31 -07:00
Catrope
0b3fe4fe8c Revert "build: Linting for .vue files"
This reverts commit f1eaa06d5e.

Reason for revert: accidentally allowed ES6 syntax.
Looking for a way to redo this that doesn't break our linting as badly.

Change-Id: I78974b97001bdbea9aff5717c69d71b8a2582ade
2020-03-30 18:08:22 -07:00
Timo Tijhof
0b4e24c995 build: Merge doc linting into 'npm test'
Whether JSDuck or JSDoc3, it's good to verify that there are no
regressions in the doc syntax. This has been enforced by WMF CI
for many years with a dedicated Jenkins job.

However, both 'grunt lint' and 'npm run doc' take a relatively
small amount of time in CI:

* grunt lint: ~ 35s (not incl 'npm install')
* npm run doc: ~ 10s (not incl 'npm install')

Bug: T225730
Change-Id: If22b7bc64266e43088c7dec8138d81c938687fb9
2020-03-18 18:40:57 +00:00
Željko Filipin
a43fd95e14 Selenium: fix Illegal option -o pipefail
47cc31d changed running selenium.sh using sh instead of bash. This
commit reverts back to bash, since sh does not support pipefail.

Bug: T247983
Change-Id: Ia2706051d40a6c26156fef77744cf5dff3a8cf95
2020-03-18 16:07:13 +01:00
AronDemian
47cc31de95 tests: Enable 'npm run selenium' on Windows
Run the script explictly via sh, the default is cmd.exe on Windows.
Also ported from bash to sh per Jforrester's request.

Change-Id: I96b66c6ae01a1761619955be2e8a3dbc64edff18
2020-03-15 21:46:50 +00:00
Timo Tijhof
4029fbf38a build: Remove unused 'jpeg-js' npm dev dependency
Follows-up 7d9e117d91, which added this for use in WikibaseMediaInfo,
which should have been added there instead of here.

This has since been fixed.

Change-Id: I6d5b0c93c3de457da0bf54859f05b1836eccc84f
2020-03-02 02:22:43 +00:00
James D. Forrester
0461692f45 build: Updating npm dependencies
* grunt-stylelint: 0.12.0 → 0.14.0
* stylelint-config-wikimedia: 0.7.0 → 0.9.0

Change-Id: Ia055fbfd75e1d3a8b771e08a6b0dbd7de61c7a98
2020-02-18 17:23:11 -08:00
Roan Kattouw
f1eaa06d5e build: Linting for .vue files
Install eslint-plugin-vue, which lints JS inside <script> blocks in
.vue files, and also lints Vue templates. Configure eslint and stylelint
to run on .vue files. stylelint automatically picks up on CSS in <style>
tags.

You may have to change a setting in your text editor or IDE to make it
run eslint and stylelint in .vue files. For eslint, see
https://eslint.vuejs.org/user-guide/#editor-integrations ; for
stylelint, I had to install the linter-stylelint-plus Atom plugin then
add source.css.embedded.html to the "Base Scopes" setting for that
plugin.

Change-Id: I7e6a13317792fc25c29106739b0c24864fd8d301
2020-02-05 18:51:39 -08:00
Clara Andrew-Wani
f07d7ba699 Move tests from api-testing repo into Core
Except for Search & Watchlist, which need fixes in gated extensions first.

Change-Id: I88d24dda4bc047868de3ff9dd4a5753b9c7b0f64
2020-02-05 16:07:54 -08:00
James D. Forrester
8c3f6440e4 build: Update qunit and all karma-related tools to latest
karma                   3.1.4  →  4.4.1
 karma-chrome-launcher   2.2.0  →  3.1.0
 karma-firefox-launcher  1.1.0  →  1.3.0
 karma-qunit             2.1.0  →  4.0.0
 qunit                   2.9.1  →  2.9.3

Bug: T222293
Change-Id: I76d9fe8b6b189a9a334411f3b62014c234002edc
2020-02-03 13:28:24 -08:00
Timo Tijhof
6143f757ea selenium: Replace wdio-chromedriver with ./selenium.sh script
This package was serving two purposes:

* Install chromedriver automatically.
* Start chromedriver automatically when using the
  'npm run selenium' entry point (e.g. for local development).

For the CI entry points (selenium-test, selenium-daily) the
chromedriver is skipped. For those, we expect the CI runner to
have started a chromedriver server already, which allows the
server to continue running between different the test suites
of different extensions etc.

By letting WDIO start the chromedriver for local development,
we had the benefit of 'npm run selenium' directly being an alias
to the 'wdio' command. This made it easy to pass additional
arguments like --spec or --mochaOpts for running specific tests
only and overall makes things easier to reason about from a
developer perspective with fewer (required) layers of
indirection you see and need to understand when debugging.

But, this has also caused problems. Specifically, it means
developers have to use the same version of Chrome locally
as we specify in package.json which isn't very flexible. While
we could try to keep this up-to-date roughly, that too isn't
an option because the secure environments we recommend for local
use (Quibble and Fresh-node) both use a Debian distro with
typically older versions of Chromium than your local auto-updating
Google Chrome.

For now, let's go back to moving the responsibility of installing
chromedriver together with the responsibility to install Chrome
itself.

== Changes ==

For CI, nothing changes (it already installs both).

For developers using Quibble, Vagrant or Fresh nothing changes
(already installs both).

For developers who make their own secure environment, they will
need to make sure chromedriver is installed, just as we required
between 2017 and Aug 2019 before my commit 1955a8aa56.

== How ==

wdio-chromedriver cannot start a foreign install because the
protocol can change between versions, so unfortunately together
with not using chromedriver from npm, we also can't use
the wdio-chromedriver autostart mechanism. Instead, I'm bringing
back Antoine's shell script that did this prior to ebda397c54.
But, with a few tweaks so that it forwards shell arguments,
this way developers continue to enjoy the benefit of 1955a8aa56,
which is that 'npm run selenium -- --spec foo.js' works.

Bug: T234610
Change-Id: I03ca94315d0611d2b6abccc12cf9076d41b2c00e
2020-01-17 17:03:54 +00:00
Clara Andrew-Wani
ac4dec907b Add API-testing to core
Bug: T236680
Depends-On: I0110de1539e4d6d9d6a58d1a645c1a1c02d8127f
Change-Id: I827dc895719cc68738ebb425f8471ac38caa49aa
2019-12-19 13:20:12 -05:00
Ed Sanders
a7227221af Remove unnecessary devDependency
Change-Id: I490e29b8aeefbd54d7ebeb3ac16a918495bfe4ec
2019-10-29 11:13:59 +00:00
Ed Sanders
3c2cea4559 build: Update linters and fix errors
Change-Id: Ieb1eff174f5168bf6c9e9aaeb58ec1a1bcd33538
2019-10-23 11:22:41 +01:00
Ed Sanders
7b9bb6f7d6 Use plugin to ensure all message keys are documented
Bug: T235502
Change-Id: If77ddf2caf667504bd0f7e0150649745ae31c4e2
2019-10-21 17:05:40 +01:00
Ed Sanders
00b2315132 Build: Update eslint-config-wikimedia and fix errors
Change-Id: I9459dcee08ea7f5b54c41a2cfde965b011099f57
2019-10-03 08:33:21 -07:00
Timo Tijhof
1955a8aa56 selenium: Upgrade from webdriver v4 to v5
* Options no longer needed or no longer exist in wdio v5:
  - coloredLogs: Now always on. The underlying 'chalk' library can still
    be influenced via the FORCE_COLOR environment variable.
  - screenshotPath: Removed. Was already disabled in our config.
  - deprecationWarnings: Meh.
  - 'sync: true' – On by default when `@wdio/sync` is installed.
    The wdio v5 config generator doesn't recommend setting manually.

* The selenium.sh script was removed. It existed to start and stop
  chromedriver for local use by developers. This is now done by
  the wdio-chromedriver-service. In WMF CI, Quibble starts its own
  chromedriver (as optimisation, reused across gated repos),
  which is why the 'selenium-test' entry points remains and skips
  this.

* The wdio-mediawiki package now requires wdio v5 and Node 10.
  This doesn't affect extension repos because versions are pinned.
  Upgrade may happen at the earliest convenience.

* Several WDIO methods changed names or signature. Full list at:
  <https://github.com/webdriverio/webdriverio/blob/v5.13.2/CHANGELOG.md#v500-2018-12-20>
  Highlights:
  - browser.element() is now browser.findElement() with "$()" as alias.
  - browser.localStorage replaced by browser.setLocalStorage.
  - browser.deleteCookie() requires `name` param. To delete all at once,
    there is a new method browser.deleteAllCookies().
  - Commands that return data no longer wrapped in `{ value: … }`.
    Values are now returned directly.
  - Custom config keys are now under browser.config instead of browser.options.
    Renamed our username/password keys to be mw-prefixed, to avoid clashes
    and reduce confusion with similar config keys.
  - browser.click(selector) and browser.getText(selector) no longer exist.
    Use $(selector).click() or .getText() instead.

* Fix "no such alert" warning from specs/page.js by removing the apparently
  redundant code.

Bug: T234002
Bug: T213268
Change-Id: I908997569ca8457997af30cb29e98ac41fae3b64
2019-09-29 02:59:44 +01:00
James D. Forrester
aa7133ce86 wdio: Switch to dots reporter for brevity
Change-Id: Ica6cc3e4fc445f39ba911db14c58a486f32f7f89
2019-08-23 20:51:00 +00:00
Željko Filipin
5a78d326a7 build: use the latest webdriverio 4.x related packages
Updating packages removes dependency on cryptiles. We were using
version 3.1.4 that had a vulnerability.

Bug: T226586
Change-Id: Idccc7f418ed6fce7452a6f0d403477953448a541
2019-07-08 15:33:44 +00:00
Ed Sanders
689d07b81d build: Update eslint-config-wikimedia to 0.13.0
Change-Id: I7df5840bc97f8bbcd8cfc875c2b48b3061ef2c9e
2019-07-05 13:32:26 -07:00
James D. Forrester
6b1e651255 build: Upgrade stylelint-config-wikimedia from 0.5.0 to 0.6.0 and make pass
Change-Id: I062bed7889cdfcc48eab9594200fc1d4767dda8c
2019-06-10 14:49:49 -07:00
James D. Forrester
effb830977 selenium: Re-add all tests and wdio-mocha-framework, now v0.6.4
This reverts commit c3878c08b5.

Now that we're running on node10, this will fail until we fix
things.

Bug: T213268
Bug: T222406
Change-Id: I5935fc5d5bc23978e50275d3c99ac870b3b82f49
2019-06-03 12:56:07 -07:00
James D. Forrester
c3878c08b5 selenium: Temporarily drop all tests and wdio-mocha-framework
This is so that we can migrate to node 10 in CI. It should only land
for an hour or so, and is to be reverted as soon as we get CI up to
node 10 and working, lest our suites of selenium tests become
subject to bitrot.

Bug: T222406
Change-Id: I9473e0213c070a0e963913fd81062c6bbf9ec2f2
2019-06-03 14:33:42 +00:00
Michael Holloway
6a75d6e473 npm: bump grunt-karma to 3.0.2
`npm install` currently fails due to an unsatisfied peer dependency.
See full output here:

https://phabricator.wikimedia.org/P8552

Bumping the required grunt-karma version to the latest (3.0.2) fixes
this.

Change-Id: I5b7f2deba2d766b809a964f53cb22f47f0617bd6
2019-05-21 17:28:48 -04:00
Željko Filipin
7d9e117d91 selenium: Add jpeg-js to devDependencies
It is needed for I92739d84947ac146e in WikibaseMediaInfo Selenium tests.
It can not be added there because of T199116.

Bug: T219815
Bug: T199116
Change-Id: Ib7c3b1b49c280bdc38c40c6aef900a605c1e3cbe
2019-05-10 16:08:46 +00:00
James D. Forrester
7fdc5220f2 build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlint
Bug: T220036
Change-Id: I7088f9eeb9468b14efb2773fde5f55fd5c95a489
2019-05-06 13:48:40 -07:00
James D. Forrester
92b090e9e3 build: Upgrade grunt-banana-checker from 0.6.0 to 0.7.0 and make pass
Change-Id: I4c604ab50caeffc5738c719c17f19e769082376f
2019-04-30 13:26:02 -07:00
James D. Forrester
83c5805c2e build: Upgrade grunt from 1.0.3 to 1.0.4
Change-Id: I9bfada10337dbab4cb5c77348f5f0df6cfab40a7
2019-04-30 13:25:38 -07:00
Ed Sanders
9097f95ecc build: Update eslint-config-wikimedia to 0.11.0
Change-Id: Iee025a518962e68c5ec2c07d952f402cd2a7f69b
2019-02-20 23:36:03 +00:00
Timo Tijhof
d056d4c273 build: Use headless Chrome and Firefox for QUnit testing
Also:

* Remove "watch" task from Gruntfile.
  This wasn't exposed via npm-run and afaik rarely if ever used.
  It seems mostly obsoleted by modern editors which perform
  linting and style guidance as-you-type and on-save.

* Remove "chromium" target from karma config, the default
  target supports both Chromium and Chrome.

* Remove unused "default" alias in Gruntfile. Was only
  accessible if developers installed grunt-cli globally, which
  we don't require and shouldn't encourage. The new minify task
  is now exposed as "npm run build".

* Remove "test" alias in Gruntfile. Was only used by "npm run test",
  which now uses "grunt lint" directly, which makes it more clear
  that these are only linters, and not unit tests.

This references T211784 because ensuring no headed browsers are used
(which would need Xvfb to start), is a prerequisite for the new Node 10
images. We may still need to provide a slower Xvfb-wrapped variant for
some repos, but would be nice of mw-core wasn't one of them.

Bug: T211784
Change-Id: I270a16d2b4f799ac7c9f84e9e2ee23806bdbc57e
2019-02-10 06:26:10 +00:00
Timo Tijhof
bce938566d build: Update karma to 3.1.4
This fixes the bug where HeadlessChrome was always shown as
version 0.0.0 in the console output, which makes it rather
difficult to debug which Chrome version is installed.

Upstream https://github.com/karma-runner/karma/issues/2762,
which updates the ua-parser library to a version that fixes
that bug.

Change-Id: I0b7fe7f8a90649592c4d31fb3055cdc9e8d34814
2019-02-10 04:10:32 +00:00
Volker E
c0e967ebab build: Add 'svgmin' Grunt task and crush SVGs
Adding 'grunt-svgmin' package and corresponding 'svgmin' task and
also crush SVGs. Several of them are featuring bad UX and are not optimal
in many different angles (a.o. clarity, universality, recognizablity etc.).
Specifically the 'mediawiki.skinning' ones.
But while they are here, let's make them suck less.

Change-Id: I8191ceac14565ae31d941982fab1586fa9b6bbdd
2019-02-06 22:03:48 -08:00
Ed Sanders
b685292d82 build: Update eslint-config-wikimedia to 0.10.1
Change-Id: Id98af16c1ec1c6c4a790948a35e96e2fe925ebb5
2019-02-02 11:05:04 -08:00
Timo Tijhof
8d4b218ee7 build: Remove unused 'deepmerge' package
Was added for wdio-related code, but not used in the end.
The only reference to this module anywhere in Wikimedia Git is
mediawiki/extensions/CirrusSearch, which doesn't use it for
its regular or daily tests, but rather the integration test,
which already has its own copy of this module in package.json.

Change-Id: Ifdf4362077f4684a2866363e35d0aca2f89f48b5
2019-01-21 15:13:42 -08:00
Volker E
0a2ac54ba3 build: Remove 'stylelint' package as it gets pulled-in by 'stylelint-config-wikimedia'
Change-Id: I734ebf6c18a3266bec2d9c9e38e827c3ec412586
2019-01-10 13:23:33 -08:00
jenkins-bot
41a744cba7 Merge "build: Update qunitjs to 2.9.1" 2019-01-08 19:00:37 +00:00
Ed Sanders
b3e490bba6 build: Update eslint-config-wikimedia to 0.10.0
Change-Id: I2930bcabeeb7b7b2eb36063e77b26e664a691b43
2019-01-08 17:40:11 +00:00
Timo Tijhof
9cd3b52723 build: Update qunitjs to 2.9.1
Code and integrity from <https://code.jquery.com/qunit/>.
Release notes at <https://github.com/qunitjs/qunit/releases>.

Highlights for the browser version:

- [2.7.0] Reporter: Remove cost of DOM size when
  using "hidepassed=true".
- [2.7.0] Reporter: Use perf.now() for improved accurracy
  of unit test durations.
- [2.7.0] Reporter: Make debugging tests in a browser
  easier by adding timeline markers for DevTools.

Highlights for the npm package / CLI version:

- [2.9.0] CLI: Reduce dependency tree size
               from 143 packages to 9 packages.

Change-Id: I38408d90765cd18d5dd6952b8b6b30cbfa0c7ed5
2019-01-07 21:05:36 -08:00
Volker E
d939ca58a4 build: Upgrade stylelint-config-wikimedia to 0.5.0 and make pass
Change-Id: I648375927bace5fc21bd842268c645570759ce85
2018-11-28 16:30:32 -08:00
Ed Sanders
3e4e0a5774 build: Use eslint-config-wikimedia v0.9.0 and make pass
Change-Id: I7b5d228a3de4b3006751a427dec907a5bebf2f51
2018-11-23 14:20:24 +00:00
Ed Sanders
d4a2191957 build: Update eslint-config-wikimedia
Change-Id: I5a8768e1a7e3960d2c822c5f842c0ffa29e2f08b
2018-09-11 23:25:26 +01:00
James D. Forrester
a6242eff16 Bump qunit from 2.6.0 to 2.6.2
Change-Id: Id7f47eee423c2fc1289f468c6622b952814d8912
2018-09-10 13:37:48 -07:00
James D. Forrester
b0df641d31 build: Update grunt-karma from 2.0.0 to 3.0.0
Bug: T194280
Change-Id: Iba043c036c06bebd961896f390063ca9a0129eb2
2018-09-10 09:46:17 -07:00
jenkins-bot
0cbccb51b4 Merge "build: Bump most devDependencies to latest" 2018-09-07 21:54:47 +00:00
James D. Forrester
3f767b2468 build: Bump most devDependencies to latest
grunt-stylelint         0.10.0  →  0.10.1
 karma                    2.0.2  →   3.0.0
 karma-firefox-launcher   1.0.1  →   1.1.0
 karma-qunit              2.0.1  →   2.1.0
 postcss-less             1.1.5  →   2.0.0

This reduces our `npm audit` alerts down to just those from grunt-karma.

Bug: T194280
Change-Id: I7d321dd715db9d214e65ed7197e917cb7c6b14f3
2018-09-06 17:01:45 +00:00
Željko Filipin
e552e95f71 Selenium: Daily Jenkins job targeting beta cluster should run only tests that pass
Selenium tests run fine when targeting MediaWiki installation in
MediaWiki-Vagrant and in Jenkins, but fail when targeting beta cluster.
Until tests are refactored to run without failure for beta cluster, let's disable
failing tests.

Bug: T185011
Change-Id: I12da893e7d624d4ebe478bccf0706aa07c965796
2018-09-04 12:47:07 +02:00
Željko Filipin
0a56fd356d Selenium: selenium-daily NPM script
selenium-daily just calls selenium-test. It's needed for daily Jenkins job targeting
beta cluster. The script might seem redundant, but it provides flexibility. In case
a repository does not want to run all tests daily, that's easily fixed by updating
the the script.

Bug: T188742
Change-Id: Idf86f94cc31abda4bfcdc1ac4eba29206d9c91f9
2018-08-29 13:00:16 +00:00
Ed Sanders
606f2783c1 build: Update eslint-config-wikimedia to 0.7.2
Change-Id: Ibdf9cc013e1265ef461169ec2227652eaf917900
2018-08-14 19:24:51 +01:00
James D. Forrester
6450fc980b build: Upgrade eslint to 5.x
Add two exceptions for max-len and no-prototype-builtins.

Change-Id: I5d3f7a3e282a237fb5de9f0eb29b579a08c32652
2018-07-05 16:58:14 -07:00
Željko Filipin
9029425a8a Update grunt and grunt-contrib-watch to resolve vulnerabilities
`npm audit` found 27 vulnerabilities (11 low, 12 moderate, 4 high).
`npm audit fix` fixed most of them.
There are 8 vulnerabilities remaining (2 low, 6 moderate).

Bug: T194280
Change-Id: I05d80bc38d16be8249a27d94dad8e13c65139545
2018-06-15 13:46:46 +02:00
addshore
0f472c4bc1 npm selenium command, use bash
On Windows this seems to complain unless bash is specified

Change-Id: I4515c851ffea143d4c1c6d111ffdd64b62f9f304
2018-06-11 07:31:02 +00:00
Ed Sanders
5e18d925e7 build: Introduce eslint-plugin-qunit and enforce
Change-Id: Iefe06cc865c458000ca5350c2d9205f5b768bac8
2018-06-05 21:58:25 +01:00
Željko Filipin
dba1de4627 build: update to grunt-contrib-watch@1.0.1 to resolve a vulnerability
Recommended by `npm audit`.

Moves us from

21 vulnerabilities ... 12 Low | 5 Moderate | 4 High

to

20 vulnerabilities ... 11 Low | 5 Moderate | 4 High

Bug: T194280
Change-Id: I9d6d2fed4ca3d4c43d9b5085873210493081f7e0
2018-05-11 16:30:32 +02:00
Željko Filipin
5dce51470d build: Update Karma to v2.0.2
The current version has a couple of dependencies with high severity
vulnerabilities.

Bug: T194280
Change-Id: I3f9f36a6a5c2ba1716b91d14e59bc60f9e0ff513
2018-05-10 15:58:32 +00:00
jenkins-bot
45258656ab Merge "build: Update Karma's qunit from 2.5.0 to 2.6.0" 2018-05-10 14:36:33 +00:00
Timo Tijhof
3166ab5f00 build: Update Karma's qunit from 2.5.0 to 2.6.0
Follows-up 065b21b4bd which updated the copy of QUnit used
on Special:JavaScriptTest.

Change-Id: I24b17c9c266f58d48caa9c3392496c469b3ddba0
2018-05-10 14:12:17 +01:00
Željko Filipin
d888d84e60 Fix a critical NPM package vulnerability
NPM v6 audits packages during installation. This is the only critical vulnerability.

Bug: T194280
Change-Id: I5fe35067919ad67b9781701136e290eda17c3afa
2018-05-10 14:13:45 +02:00
Timo Tijhof
16a4d9da7b selenium: Initial version of wdio-mediawiki package
This is new package will be reusable by other repositories for
their browser tests, without having to reference the internal
selenium/pageobjects/ directory from MediaWiki core.

In addition to not requiring direct imports, it will also avoid
problems in the future by allowing the package to be versioned
and iterated upon without forcing an atomic global upgrade
(or broken master builds), everytime we change something.

See wdio-mediawiki/README for details.

Within MediaWiki core itself, the package is used using the
'file' specifier in its package.json, so that we always test
and develop using its working copy, which makes drafting and
testing changes easier.

Also misc changes to make wdio.conf easier to understand.

Bug: T193088
Change-Id: I547a7899e7a97693a93567dd763784e637433d55
2018-05-09 14:43:30 +00:00
Timo Tijhof
2729bf4653 selenium: Minor clean-up in preparation for packaging
This is functionally a no-op, purely refactoring (mostly style).

* Consistently require packages at the top of a file.
  (e.g. MWBot in edit.page.js).

* Remove unused .call(this) from mwbot interaction closures,
  which didn't use 'this'.

* Use Node.js regular Promise chaining with then(), instead of
  complex bluebird.coroutine generator function yields, which
  are intended to emulate async-await, but the syntax is quite
  error-prone for inexperienced developers and hard to debug.
  Once we require Node 7+ for the selenium tests, we can use
  async-await here natively, but until then, might as well use
  regular then() syntax, which we already use elsewhere in the
  tests, and is also what MWBot documentation uses.

* Also applied some minor whitespace changes for consistency
  among these files and other MediaWiki JS. E.g. no empty line
  before the first statement of a function. Add a new line between
  different methods, and between the end of a class and the
  export statement.

* Remove 'use strict' from test files. The patterns that would expose
  the bad non-strict behaviour are mostly already forbidden by ESLint,
  and the run-time optimisation to disable non-strict can't be noticed
  in tests (more useful in prod where e.g. the same process would run
  a function 1 million times). Main reason here is to keep things
  simple for new-comers and reduce boilerplate, given that these tests
  will mainly be worked on by browser-JS developers, not Node.js devs,
  and we don't currently use strict mode in our front-end code, either.

* Remove unused bluebird dependency.

Bug: T193088
Change-Id: I59f9211299e8e884c28c7733bcee3b7b28542610
2018-05-08 14:42:59 +00:00
Timo Tijhof
810afd33e0 selenium: Run wdio directly without grunt
Doesn't seem to add anything, except complexity.

This has the benefit of matching more closely the way the README
recommends running individual tests.

Also add a check for 'chromedriver' before running it.
Normally the -e and pipefail would suffice, but because
it runs in the background, the error can be buried,
hard to find, or even not cause exit code to be set
properly. Thus, do a simple 'hash' check that will
print a useful command and exit cleanly.

Before:
> $ something &
> [1] 57922
> -bash: something: command not found
> [1]+  Exit 127                something
> $ echo $?
> 0

After:
> $ hash something
> -bash: hash: something: not found
> (exit: 1) $ echo $?
> 1

Change-Id: Id95f18927b5443defe679a77a82c5cbdd127c716
2018-04-30 21:54:15 +00:00
jenkins-bot
b824f88a95 Merge "selenium: Abstract test command behind 'npm run'" 2018-04-23 16:53:11 +00:00
Timo Tijhof
83425bd0a8 build: Switch QUnit package from deprecated 'qunitjs' to 'qunit'
This should fix the deprecation warning from npm in CI logs.

Change-Id: I5d02dd8d6a86123d7935db51b8d0b5d88218869f
2018-04-23 16:32:50 +01:00
Timo Tijhof
c0600fd29c selenium: Abstract test command behind 'npm run'
This makes it possible to use in Quibble. Right now, Quibble
cannot use 'npm run selenium' yet because it sets up its own
chromedriver, which would conflict with selenium.sh.

But, in preparation for Id95f18927b5, we can at least abstract
the test command so that it can easily be changed without having
to update Quibble and without having to worry about it being the
same in all MediaWiki branches.

Bug: T179190
Change-Id: I622ec3bf36746502cae891cc6bec23982b21f876
2018-04-23 15:56:54 +01:00
Željko Filipin
d972780d8b Selenium: move logic for running tests from package.json to selenium.sh
Just running `npm run selenium` in CI does not work. If WebdriverIO fails, the
job still passes since the last command to run is  `killall chromedriver`.
Reusing the script from CI that starts and stops Chromedriver should fix the
problem.

Bug: T179190
Change-Id: If29227263d23a3e4f26e2329dfa13c49f976cf8e
2018-04-13 14:21:29 +00:00
James D. Forrester
69b1210838 build: Bump postcss-less up to 1.1.5 from 1.1.3
Problem over, we think.

Bug: T190269
Change-Id: I0a94c99fb75613b03f15954512744dec63fd779e
2018-04-04 17:43:15 -07:00
James D. Forrester
9adae152b2 build: Bump devDependencies to latest
grunt-stylelint             0.9.0  →  0.10.0
 stylelint                   8.2.0  →   9.2.0
 stylelint-config-wikimedia  0.4.2  →   0.4.3

Change-Id: I612cf96d99e2af67b3f7ef3284657f66f3e18d2e
2018-04-04 17:40:46 -07:00
Željko Filipin
c2792982c5 Selenium: install bluebird, mwbot dependency
Bluebird is implicitly installed on my machine, probably because I have a recent npm version. It needs to be explicitly installed in MediaWiki-Vagrant, probably because of an older npm version.

Bug: T190914
Change-Id: I9c704502fb5e20abf9b21d483723eb55b6fb3875
2018-03-28 13:15:57 +02:00
jenkins-bot
33fa8c095c Merge "Selenium: Replace nodemw with mwbot" 2018-03-21 15:17:06 +00:00
jenkins-bot
edf7224639 Merge "Selenium: Upgrade WebdriverIO to 4.12.0" 2018-03-21 14:37:30 +00:00
Željko Filipin
9c5fa5567b Selenium: Replace nodemw with mwbot
Bug: T181284
Change-Id: I012a5cc6a7f30a8652cbad87293eb119fa2e405f
Depends-On: Ic69be92c2b0b7a08a9b8cc417a40ebb38f249ea3
2018-03-21 13:34:37 +01:00
Željko Filipin
771c5a7814 Selenium: Upgrade WebdriverIO to 4.12.0
Bug: T180144
Change-Id: I8d34e2240fe76798c99315a54ea5bab63b2409e9
Depends-On: Ic69be92c2b0b7a08a9b8cc417a40ebb38f249ea3
2018-03-21 12:20:42 +00:00
Željko Filipin
15624aaeb9 Lock postcss-less to v1.1.3 because v 1.1.4 breaks CI
mediawiki-core-npm-node-6-docker Jenkins job is failing with
`Warning: Task "stylelint:src" failed.`

Bug: T190269
Change-Id: Ic69be92c2b0b7a08a9b8cc417a40ebb38f249ea3
2018-03-21 13:15:01 +01:00
Timo Tijhof
b043cec2d7 build: Add 'npm run qunit' command
The running of 'grunt qunit' is unconvenient due to it only working
if the user has grunt-cli installed globally, which should not be
needed because it is already installed in the local directory.

It could be worked around by instructing users to use
`./node_modules/.bin/grunt qunit`, but it would be much simpler
to instruct them to use `npm run qunit` instead.

Unlike 'composer', 'npm' does not come by default with a command
like 'composer exec' that one could pass a command directly
without needing to register it. This is fixed in more recent
versions through 'npx -c', but that's a bit too new to require
in the manual, so adding it as a run-script instead.

Change-Id: I2812b13dbed50612b1626a617ba65f92e212f01a
2017-11-22 10:48:27 -08:00
Ed Sanders
0c84c04a9b build: Upgrade grunt-stylelint
Change-Id: I4c47f1d290802705d061167fe369c130405512e0
2017-10-30 21:49:12 +00:00
James D. Forrester
67a3e5ea7f build: Bump karma devDependencies to latest
karma                   1.5.0  →   1.7.1
 karma-chrome-launcher   2.0.0  →   2.2.0
 karma-mocha-reporter    2.2.3  →   2.2.5
 nodemw                 0.10.1  →  0.11.0
 qunitjs                 2.4.0  →   2.4.1

Change-Id: I1e06189a12fbbc1d62781a4636f192c5b7078c1a
2017-10-30 21:46:42 +00:00
jenkins-bot
be2621ebe6 Merge "build: Bump eslint devDependencies to latest" 2017-10-30 21:43:51 +00:00
Ed Sanders
1064426327 build: Update stylelint
Change-Id: I5a0ccb26a54109e641fd121c6427a71e82e05c74
2017-10-27 13:31:41 +01:00
James D. Forrester
ce869f0bb4 build: Bump eslint devDependencies to latest
eslint                 3.12.2  →   4.9.0
 grunt-eslint           20.0.0  →  20.1.0

Change-Id: I7eb9964fb5d163c5bbcef850f62383cbceb59287
2017-10-26 14:16:23 -07:00
James D. Forrester
6096be63d5 Follow-up 2454f51b27: Upgrade qunit from 1.x to 2.x too
karma-qunit             1.0.0  →   1.2.1
 qunitjs                1.23.1  →   2.4.0

Bug: T170515
Change-Id: Ibc0909ed5fbde715814b0ddb1a1d1c9668d10a85
2017-10-11 16:29:02 +00:00
James D. Forrester
b96e76aeca build: Bump eslint-config-wikimedia from 0.4.0 to 0.5.0
Change-Id: I06010cd6367c1884b5536e7929d3345feba7f305
2017-08-21 17:12:17 -07:00
jenkins-bot
18bf8815c1 Merge "build: Upgrade grunt-eslint from 19.0.0 to 20.0.0" 2017-07-18 18:10:48 +00:00
Ed Sanders
2c03d167fa build: Upgrade grunt-eslint from 19.0.0 to 20.0.0
Most indent and escaping fixes.

Change-Id: I210e2fc3c0ce3148327ef81f824e1ce9f1e269b6
2017-07-18 16:57:03 +01:00
Ed Sanders
098a93b2ed build: Update grunt-stylelint
Change-Id: I05e48d3eb749d192ccd4b837e4b8dc6307d761af
2017-07-18 14:16:24 +01:00
Željko Filipin
853cba1deb Create users and pages for Selenium tests using action API
This will make tests slightly more robust.

Bug: T164721
Bug: T167502
Change-Id: I9b2fea77b28af4f7f521490a0105e7d04730bc87
2017-07-07 04:59:14 +00:00
Željko Filipin
86b867f794 Make running Selenium tests using Sauce Labs easy
If SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are not
defined, tests are run with `npm run selenium`, as usual.

https://www.mediawiki.org/wiki/Selenium/Node.js/Inside_MediaWiki-Vagrant
https://www.mediawiki.org/wiki/Selenium/Node.js/Target_MediaWiki-Vagrant

If the environment variables are defined, to run tests using Sauce Labs
and targeting Beta Cluster, run this:

```
export SAUCE_USERNAME=***
export SAUCE_ACCESS_KEY=***
export MW_SERVER=https://en.wikipedia.beta.wmflabs.org
./node_modules/.bin/wdio tests/selenium/wdio.conf.js
```

https://www.mediawiki.org/wiki/Selenium/Node.js/Target_beta_cluster_using_Sauce_Labs

Bug: T139740
Change-Id: I622d9c55ae595ab772e733388d209623e3a9f81e
2017-05-25 15:57:04 +00:00
Ed Sanders
ee3d5a014f build: Update eslint to 0.4.0 and make pass
Change-Id: Ib230392f332268ac801cf668f399fcefb1cb1cc5
2017-05-04 22:38:03 +00:00
Timo Tijhof
4a8045400a build: Sync qunitjs version for karma with version of Special page
Special:JavaScriptTest loads qunitjs from /resources/lib/qunitjs
which was upgraded in 99aad9397e to 1.23.1.

However, when running QUnit tests from the command-line, QUnit is
loaded by karma-qunit using the npm qunitjs dependency, which was
still at v1.22.0.

Change-Id: Ie24b2b061735fa03a8ed1527d09f65c103506c67
2017-04-18 16:31:42 -07:00
Paladox
7dfe22b45e build: Update karma to 1.5.0, karma-firefox-launcher to 1.0.1
karma:
 Changelog at https://github.com/karma-runner/karma/releases
 https://github.com/karma-runner/karma/compare/v1.1.0...v1.5.0

karma-firefox-launcher:
 Changelog at https://github.com/karma-runner/karma-firefox-launcher/blob/master/CHANGELOG.md#101-2017-03-04
 https://github.com/karma-runner/karma-firefox-launcher/compare/v1.0.0...v1.0.1


Karma v1.1.1 added use of `<script crossorigin="anonymous">` for
the urls it initially loads. While most requests will be done by
MW itself directly (and served locally via the proxy at /w/) the
initial request cannot come from the proxy and is loaded from wgServer
directly. Therefore we need to set crossOriginAttribute=false to override
the new default that v1.1.1 introduced.

Change-Id: I9f5067b949c0a77e46f47c2a110a7b5df5953fda
2017-04-15 03:14:55 +00:00
James D. Forrester
0190d6cbb6 build: Bump grunt-banana-checker from 0.5.0 to 0.6.0
Change-Id: I64d4267d20716b893237f7f13729343593c8d382
2017-03-28 15:08:05 -04:00
Antoine Musso
c35a2c0567 build: karma now reports with mocha formatter
The progress reporter is quite nice to avoid spammy output to the
terminal, but it is not very human friendly when trying to find out what
is breaking.

Mocha has a very nice reporting organized as modules and list items for
each of the tests:

ext.cx.tools.template
  ✖ Equivalent template exists
  ✔ Adapting a template not existing in target language
  ✖ Adapting template having invalid title
  ✖ Template name and params adaptation using templatedata
  ✖ Template params adaptation using templateData - English to French
  ✖ Template params adaptation using templateData - English to Spanish

Add karma-mocha-reporter node module and make it the reporter.

Change-Id: Ic7d848b45e8e5ad3839d8a2bd822b63838319ad7
2017-03-20 19:12:18 +00:00
Željko Filipin
7aee98758a Selenium tests in Node.js using WebdriverIO
Introduce the WebdriverIO browser testing framework driven by Node.js.
The overall intents are:
* have MediaWiki core to provide a platform to run tests that is shared
  between core and the extensions.
* phase out ruby driven browser tests eventually.

Code is namespaced in sub directory /tests/selenium
The 'pages' sub directory provides helper representing a MediaWiki page
such as Special:Login and human friendly helpers to interact with the
elements.

Add Grunt task webdriver:test.

Provide a npm script to easily spawn/dispose chromedriver and run above
grunt task.

wdio.conf.js provides all the configuration. It defaults to point to a
MediaWiki-Vagrant installation on http://127.0.0.1:8080. Can be
overriden with environment settings as needed.

glob patterns (specs) are made absolute paths from MediaWiki root path
that let us run the tests either from the root path (eg the npm
wrapper or from the tests/selenium directory when invoking wdio
directly. wdio assumes they are relative to the current working
directory, hence the normalization.

wdio.conf.jenkins.js extends the configuration and is used solely for
Jenkins.  The switch is done from the Gruntfile.js whenever JENKINS_HOME
is set.  Specially we want junit reports to be generated.

Provide a more specific eslint configuration.

References:

* MALU https://phabricator.wikimedia.org/source/malu/
* T151442 Research WebdriverIO
* T151443 Research Nightwatch.js

Bug: T139740
Signed-off-by: Antoine Musso <hashar@free.fr>
Change-Id: Ibe7a004a120e82af637ab3e31b725de743134c99
2017-03-14 12:20:32 +01:00
James D. Forrester
36f2a780a1 build: Bump stylelint and make pass
grunt-stylelint              0.6.0  →   0.7.0
 stylelint-config-wikimedia   0.3.0  →   0.4.1

Change-Id: Id87b8df04d415e1f1058a4042a31408236402037
2017-02-17 15:26:05 -08:00
Antoine Musso
307ead451c build: Upgrade karma-chrome-launcher to support Chromium on Mac/Windows
Before karma-chrome-launcher 2.0.0, Chromium was only detected on Linux
and as part of the "Chrome" setting. "Chromium" is now recognised as a
separate browser and is detected on Mac and Windows as well.

https://github.com/karma-runner/karma-chrome-launcher/issues/45

Add a grunt target for Chromium so users may run the following to use
Chromium instead of Chrome:

    grunt karma:chromium

Since we keep the default of "Chrome", we'll need an override for CI
since we install Chromium there instead of Chrome.

Depends on Ie9f906f8 being merged and Nodepool images updated.

Bug: T153756
Change-Id: I6ba0d971e7e8c3022d2ab6268ae637688189d768
2017-01-12 20:37:02 +00:00
Paladox
4185d29d39 Pin eslint version
We don't want tests failing every time upstream publishing a new
version.

Instead we should bump this manually everytime they update to make sure
no failures happen.

Bug: T118941
Change-Id: I1c76dacd0950100825b85a3791f74c1f6d5477d9
2016-12-21 00:55:41 +00:00
James D. Forrester
113856971c build: Bump jsonlint devDependency to latest
grunt-jsonlint   1.0.7  →  1.1.0

We can't bump the karma/qunit modules due to issues with our CI.

Change-Id: I15595df8b30a8ef4ddb6471acdd8d4da4f4afabc
2016-11-22 23:57:40 +00:00
James D. Forrester
62177fc1db build: Bump eslint-config-wikimedia to v0.3.0 (already passes)
Change-Id: Iee727a4521acd8c221733c7bd763cbf2adb9bd49
2016-11-15 15:15:52 -08:00
Ed Sanders
c0fb8a8836 build: Replace jscs+jshint with eslint
Change-Id: Id0a23c03aabadfaf2ec705528ae4b3bd0908fa3e
2016-11-15 15:15:52 -08:00
James D. Forrester
7c9c67b9bf build: Fix stylelint devDependencies
Change-Id: I26cee89c27e3cd8f3c1fc48088b2a8e8b3927e4a
2016-08-05 11:04:02 -07:00
Paladox
0a84165e6c build: Bump grunt-karma and related tools to 1.0.x
Also bump karma to 1.1.0 see changelog at
https://github.com/karma-runner/karma/releases please

Change-Id: Ic982dfc7ccebeecd6082b5476372cbb87fec5f1b
2016-07-11 12:11:41 +01:00
James D. Forrester
36cf480f59 build: Bump grunt-stylelint to v0.4.0 and make pass
Change-Id: I00e469cf9b484c9d4d4ad145480fa6e66dd7e8cc
2016-06-24 14:16:59 +00:00
Hashar
7b17005ab3 Revert "build: Bump grunt-karma and related tools to 1.0.x"
Karma is suspected to have an issue disconnecting Chromium.
That causes the qunit job to idle even after all tests have
been completed.

This reverts commit 72b0d9da08.

Bug: T136188
Change-Id: Id818f5a0d1983d0bffa545f7731a780bf2b9bf25
2016-05-26 19:58:47 +00:00
James D. Forrester
9e76649693 build: Bump grunt-stylelint to v0.3.0
Change-Id: I012d8b8cb2851270180f1a981c49a8a5043ae218
2016-05-19 19:05:36 +01:00
James D. Forrester
72b0d9da08 build: Bump grunt-karma and related tools to 1.0.x
Change-Id: I3d8ad9fbd3b6950c13bf400790eb97fe4e94f849
2016-05-19 15:43:37 +01:00
James D. Forrester
3bf6f42929 build: Introduce stylelint
Initially, with just a single rule to make this a smaller change that we can
incrementally extend up to the full Wikimedia coding conventions preset; namely,
forcing hex references to colours to be in lower-case.

Note the odd src definition to avoid referring to mediawiki.less the directory in
the glob.

Change-Id: I34f0c8e3c8280e3fce0aa22d7537100b850cbb8d
2016-05-19 15:41:15 +01:00
Ricordisamoa
a6f243ae00 Bump grunt to 1.0.1, remove grunt-cli
Change-Id: Ic04c3a0b0237c8785f54b83f1bcfb64a3978d768
2016-04-06 04:24:34 +02:00
Paladox
0c471ab36c Update grunt-banana-checker to 0.5.0
This fixes a json crash according to release notes at
https://github.com/wikimedia/grunt-banana-checker/releases/tag/v0.5.0

Change-Id: I7cb37b3f1289b8b91bd98d770ebe58e4c3c6aae5
2016-03-30 22:32:16 +01:00
James D. Forrester
f883f83762 build: Bump npm development dependencies to latest
grunt-contrib-copy     0.8.2  →    1.0.0
 grunt-contrib-watch    0.6.1  →    1.0.0
 karma                0.13.19  →  0.13.22

Change-Id: Idc5c1ac97580e91d9c958c55cdfdda681330c254
2016-03-19 19:06:44 +00:00
Paladox
50817f09a0 Update grunt-karma to 0.12.2
Reason because this update will include a fix for incompatibility with
grunt 1.0.0 when it is released.

Change-Id: I39f01e3a68b764a4638c3465a1d116aefd517ef5
2016-03-18 23:39:28 +00:00
jenkins-bot
1fc267206c Merge "build: Update grunt-jscs to 2.8.0" 2016-03-13 07:54:39 +00:00
Paladox
5a1a6e8440 build: Update grunt-jscs to 2.8.0
Change-Id: Ica4fac1bee551467614a76c76aa699406927c9a4
2016-03-13 07:42:17 +00:00
Timo Tijhof
e49cccc683 Update Karma's QUnit to v1.22.0
Follows-up 54bbef467d, which updated the version used by
MediaWiki's Special:JavaScriptTest.

Change-Id: I7876808c3b5ac88976706cdff1cf7abe8075cfdb
2016-03-12 18:53:37 +00:00
Paladox
f45608ea3e build: Update grunt-contrib-jshint from 0.12.0 to 1.0.0
Changelog at
https://github.com/gruntjs/grunt-contrib-jshint/blob/v1.0.0/CHANGELOG

This release includes a fix to the checker because sometimes it would
not show where the error was coming from.

Change-Id: Ia2e7d6520b760bdc80f7e24051ec578954aa0706
2016-02-22 22:15:28 +00:00
James D. Forrester
864cc26168 build: Bump grunt-contrib-jshint from 0.11.3 to 0.12.0
Taking the opportunity to modernise our .jshintrc file, I have made the
following changes there and adjusted the repo to pass:

* Replaced the deprecated `"es3": true` with `"esversion": 3`; nil change.
* Adjusted `"latedef": true` to `"latedef": "nofunc"`, a new setting for this
  option that lets us retain previous behaviour. One call needed to be adjusted
  for the update with this change; without it, several dozen were needed.
* Added `"futurehostile": true`, to make bumping `esversion` easier in future.

I have reviewed the rest of the options and chosen not to apply them:
* No need to over-ride the runtime option `maxerr`.
* No need to add the additional 'enforcing' options: `forin`, `nocomma`,
  `nonbsp`, `notypeof`, `predef`, `shadow`, `singleGroups`, `varstmt`.
* No need to add the additional 'relaxing' options, as ideally we should use
  none: `asi`, `boss`, `debug`, `elision`, `eqnull`, `evil`, `expr`,
  `lastsemic`, `loopfunc`, `moz`, `noyield`, `plusplus`, `proto`, `scripturl`,
  `supernew`, `validthis`, `withstmt`
* Definitely no need to add any of the deprecated coding style-related items:
  `camelcase`, `curly`, `immed`, `indent`, `laxcomma`, `maxlen`,
  `maxcomplexity`, `maxdepth`, `maxparams`, `maxstatements`, `newcap`,
  `noempty`, `quotmark`, `sub`

Note that we retain two deprecated options, `laxbreak` and `multistr` which are
set to be removed in the next major version of jshint but are as-yet required
for the repo so that it passes.

Change-Id: I2a780f655010f2231ab2ab93c40b34943828b4df
2016-02-06 18:41:45 -08:00
James D. Forrester
1ef92ba549 build: Bump devDependencies to latest
* grunt-contrib-copy: 0.8.1 -> 0.8.2
* grunt-jscs: 2.6.0 -> 2.7.0
* karma-qunit: 0.1.5 -> 0.1.9

Leaving grunt-contrib-jshint for a follow-up patch.

Avoiding upgrading qunitjs again due to incompatibility of recent versions.

Change-Id: Ie4d2f63c3ec247f1bad26ca5d954362210394618
2016-02-06 17:46:44 -08:00
Paladox
cbf8be4f42 build: Update jscs to latest
* grunt-jscs: 2.5.0 → 2.6.0

Change-Id: I4b1585c557b94927e593975e2e4696b88becd095
2016-01-08 16:37:21 +00:00
Paladox
ce0db4678c Update packages to do with karma
Packages updated are:

karma-chrome-launcher updated to 0.2.0

karma-firefox-launcher updated to 0.1.7

Change-Id: I542436bf8f0d782fc2af57a170faf936271b2bf9
2016-01-06 15:32:25 +00:00
Paladox
522e673e7e Update karma to 0.13.19
Bug: T122941
Change-Id: Iee84646b0f914bceb254ffc18d678d916c38eb20
2016-01-06 02:47:06 +00:00
Paladox
4798892b0d Update grunt-jsonlint to 1.0.7
This update now tells you on which line in which file the error happends.

Changelog is

1.0.7 Include file name and JSON source line number in error messages

1.0.6 CJSON support thanks to @fredghosn, unit tests

Change-Id: I38dc4a51416cfde0bb0434921d15f1c119abc01b
2015-12-24 14:12:42 +00:00
Paladox
9a1e6f8ab7 Update grunt-jscs to 2.5.0
2.5.0

Bump JSCS version to  2.7.0

2.4.0

Bump JSCS version to  2.6.0

2.3.0

Bump JSCS version to  2.5.0

2.2.0

* Update  jscs  dependency to  2.4.0
* Use new  Checker#execute  method, which allows to respect  maxErrors
* option when  fix  option is enabled
* fix  option is now directly passed to  Checker  class of  jscs
* Use new "idiomatic" preset instead of "jquery"
* Test in latest version of node in travis CI
* Update dev dependencies

https://github.com/jscs-dev/grunt-jscs/releases

Change-Id: I472a3c63fff814357799a3889b09bbb6a977474b
2015-12-09 21:45:44 +00:00
Paladox
40a85d0aa3 Update grunt-jsonlint to 1.0.5
This is a minor update there were packages updates in this version.

Change-Id: I43cced8c20153d06f764ebba90f64de0431e2d3f
2015-10-24 15:55:55 +01:00
James D. Forrester
b9b4cb5846 build: Upgrade grunt-banana-checker from v0.3.0 to v0.4.0
Take opportunity to drop no-longer-needed options.

Change-Id: I11250c12d2123d4729e12cd0dce07b24fc5008e5
2015-10-12 14:13:54 -04:00
jenkins-bot
808b957704 Merge "build: Bump various devDependencies to latest" 2015-09-28 23:38:36 +00:00
James D. Forrester
1e3264831d build: Set private flag in package.json (for now)
This fixes the warning about missing package description and license.
This matches what we do elsewhere for dev-only npm pipelines.

Change-Id: I29ee43482b90ea8875a5376409d656648e3c4b27
2015-09-28 11:52:19 -07:00
James D. Forrester
789e8b4676 build: Bump various devDependencies to latest
* grunt-contrib-copy: 0.8.0 -> 0.8.1
* grunt-karma: 0.11.0 -> 0.12.1
* karma: 0.12.36 -> 0.13.10
* karma-chrome-launcher: 0.1.12 -> 0.2.0
* karma-qunit: 0.1.4 -> 0.1.5

All already used in other repos.

Change-Id: If1548e9708aa9c8c97c9d2de14ffb4e8ada933fd
2015-09-25 10:47:06 +01:00
James D. Forrester
6a9bbcdca8 build: Upgrade grunt-banana-checker to v0.3.0
Disable disallowBlankTranslations, disallowDuplicateTranslations and
disallowUnusedTranslations for now as they fail so much.

Change-Id: I52e1555335a6e64b1e9db541ba726cf6ce8c7dd0
2015-09-07 16:42:21 -07:00
James D. Forrester
5ac63862df build: Bump grunt-jscs to 2.1.0 and make pass
Change-Id: I7c5a38ad16c471bb1443a5bde56dda4203fcfad5
2015-09-03 21:30:31 +00:00
paladox
e64b54a8b9 build: Update grunt-contrib-jshint to v0.11.3
Change-Id: I2170f77042d4f31914c684bf6bdc08321abe14db
2015-09-03 20:58:58 +00:00
Kunal Mehta
e410918e5f build: Updating development dependencies
* grunt-banana-checker: 0.2.1 → 0.2.2
* grunt-karma: 0.10.1 → 0.11.0
* karma: 0.12.31 → 0.12.36
* karma-chrome-launcher: 0.1.8 → 0.1.12
* karma-firefox-launcher: 0.1.4 → 0.1.6

Change-Id: Ic8bd8563c6f3313a7c8fc936c0753b071441c2b0
2015-06-07 22:41:11 -07:00
James D. Forrester
5f7c6c5805 build: Bump various devDependencies
grunt-contrib-jshint:  0.11.0 -> 0.11.2
	grunt-jscs:            1.5.0  -> 1.8.0
	karma-chrome-launcher: 0.1.7  -> 0.1.8
	qunitjs:               1.17.1 -> 1.18.0

Some trivial indentation and line-spacing changes to make this pass jscs.

Change-Id: Ieeb6dbcd3e6d9f6f0fb9865d356da462b9b0499b
2015-05-01 23:00:45 +00:00
James D. Forrester
6411ef8320 build: Update grunt-banana-checker to v0.2.1
Change-Id: I7b60b856d8cf21640c382647c6570e32091b5cde
2015-03-27 16:48:58 -07:00
Timo Tijhof
fa4ba8dbd7 build: Declare grunt-cli dependency
A long time ago, npm did not support using command line programs
within 'npm test' (not unless harcoding a path to node_modules/bin/...
within packages.json/scripts/test). But this has been long supported.

Declaring a (dev)dependency will provide its binaries to the
PATH used by the subshell 'npm test' creates internally.

Add grunt-cli so that developers don't have to manually install it.

Change-Id: I6a7fafa3c6e40d2407f07c514167ab9fc7661685
2015-03-19 01:08:57 +00:00
Timo Tijhof
3bbd27aa49 Rename JSDuck config to standard 'jsduck'
* Move configuration to /jsduck.json per standard. This way
  it can be run as plain '$ jsduck' without needing a maintenance
  script or custom Jenkins job. Similar to JSHint, JSCS, Grunt,
  and Gem etc.

* Move --processes=0 from maintenace script into config file.
  This should've been in the config file all along and serves as
  workaround for https://github.com/senchalabs/jsduck/issues/525.

* Use grunt-contrib-copy instead of a symlink for resources.
  For local development a symlink works fine, but for publishing
  from Jenkins to doc.wikimedia.org the /docs/js/ directory needs
  to be standalone. This was previously done with a manual post-build
  step that added an additional rsync, but this logic should be
  in the repository so that the doc entry point can be simplified
  and standardised to 'npm run-script doc' for all projects.

Change-Id: Iaaaac50ee78dd9ff8f24f1ef3a3685ad51cf33b2
2015-03-09 18:10:00 +00:00
James D. Forrester
8626b8823d build: Bump various devDependencies
grunt			0.4.2	-> 0.4.5
grunt-contrib-jshint	0.10.0	-> 0.11.0
grunt-jscs		0.8.1	-> 1.5.0
grunt-karma		0.9.0	-> 0.10.1
karma-firefox-launcher	0.1.3	-> 0.1.4
qunitjs			1.15.0	-> 1.17.1

Some minor fixes to pass new jscs rules; big ones postponed for now.

Change-Id: I5f2348c3cf96cf5aa20eeb9083300155b3920c5b
2015-02-10 00:52:15 +00:00
Alex Monk
1ac1512db8 Update karma to latest version
Per Timo, hopefully this should fix our issues with Chromium timing out
after 10 seconds?

Related patch: https://github.com/karma-runner/karma/commit/840ee5f7

Change-Id: Idbac350e2c612290f860ae740ef6ba242c9e0896
2015-01-30 21:46:20 +00:00
Timo Tijhof
57f5e6bf20 tests: Move npm-test to repo root
This is way overdue as it isn't experimental anymore.
Keeping it in a non-standard subdirectory makes it harder to
discover for people. And makes it harder to run from Jenkins
since this is already being ran on every commit.

Related to 70f3919.

Change-Id: Iaf5cf65616f82640145fbb6395c36129428602ca
2015-01-14 00:44:54 +00:00
Renamed from tests/frontend/package.json (Browse further)