Commit graph

210 commits

Author SHA1 Message Date
Stephen Niedzielski 95047ba360 Fix: code coverage
Replace Istanbul with nyc, Istanbul's CLI. nyc appears to have some
bugs that this patch works around:

  - When all files in the project are considered, not just those
    imported via tests, the coverage rates and line numbers vary between
    runs. This patch disables the `all` option for now and points to the
    bug:
    https://github.com/istanbuljs/nyc/issues/537#issuecomment-390814662.

  - Source map line numbers appear to be incorrect except when `all` is
    enabled and working correctly (see previous bullet).

  - `sourceMap` must be disabled to avoid ENAMETOOLONG errors when nyc
    tries to include them as encoded strings. The patch disables the
    setting and points to: https://github.com/istanbuljs/nyc/issues/847.
    Using babel-plugin-istanbul and source-map-support appears to have
    no effect (the former in tests/node-qunit/run.js and .babelrc).

  - CI fails with
    `Error: EACCES: permission denied, mkdir '/nonexistent'`. Specify
    `SPAWN_WRAP_SHIM_ROOT` instead of constructing a subdirectory from a
    nonexistent home directory.

Bug: T196952
Bug: T193519
Change-Id: Idf2e3accd4a6277cbef91c1156fcd206c9e7d882
2018-06-19 18:10:02 -05:00
Stephen Niedzielski fe2c3b23ee Hygiene: replace call to rm with clean-webpack-plugin
The invocation of `rm -rf resources/dist` in package.json
(`check-built-assets`) is replaced with clean-webpack-plugin.
The benefit of this change is that calling `npm run build` now works the
same as the `check-built-assets` script.

Bug: T193522
Change-Id: I64f048855ddceb7159279671b2174a7937e169ff
2018-06-18 09:09:28 -05:00
James D. Forrester a678df93a0 build: Bump lint devDependencies to lastest
grunt                          1.0.1  →    1.0.2
 grunt-contrib-watch            1.0.0  →    1.0.1
 grunt-stylelint                0.9.0  →   0.10.0
 nodemon                       1.11.0  →   1.17.3
 stylelint                      8.2.0  →    9.2.0
 stylelint-config-wikimedia     0.4.2  →    0.4.3

Avoid old (very up) upstream's security issue from nodemon.

Change-Id: I3dcf94746b4383baeae4fe6e2bf95c5da5b87db1
2018-05-01 10:35:23 -05:00
joakin 3c63686da7 Chore: Upgrade mw-node-qunit to 4.0.0
* https://github.com/joakin/mw-node-qunit/blob/master/CHANGELOG.md#400
  * Rely on the CLI runner from qunit
  * Fix testing require and global mediaWiki not asserting anything

The test numbers is not reported by test, instead of by assertion like
it was before because the official qunit tap reporter does that. But the
numbers are correct.

Change-Id: I38d4b5007902ecbef2e2007966fafc4bb88703f6
2018-04-17 09:21:47 -05:00
joakin 4e639b09d4 Update mw-node-qunit to 3.1.0
* 3.1.0
  * Added CONTRIBUTING.md
  * Update jsdom from 11.3.0 to 11.7.0
  * Upgrade jQuery from 3.2.1 to 3.3.1
  * Update QUnit from 2.4.1 to 2.6.0
  * Update prettier, fix formatting glob

* Commits https://github.com/joakin/mw-node-qunit/compare/v3.0.0...v3.1.0
* Changelog https://github.com/joakin/mw-node-qunit/blob/master/CHANGELOG.md#310

Change-Id: I16d4e4f86f59f9a2f441c915a31d1f0617b40c82
2018-04-09 11:58:04 +02:00
jdlrobson 3c892ca9f8 Add eslint auto-fixing to Gruntfile
Run `npm run lint:fix` to use

Change-Id: I445c17a57b5f240ddaa48956d7881cc3228eab76
2018-03-27 12:57:40 -07:00
jdlrobson bb2ad2ed38 Up the max asset and entry point sizes
40kb seems a good time to pause and reflect on the total size.
The current maximum is impossible to meet without no further
changes to the code.

12kb is also more flexible than 11.5

Change-Id: I5ee8c236d90542afacc0e8de513a45a15ccd529b
2018-03-27 12:57:17 -07:00
Stephen Niedzielski c4b50b04ac Hygiene: remove unused resources
In I7395e3438836149becdd576942bdaf6f21b4163f the settings templates
were rewritten so that they no longer displayed an image.

descriptionText and images were dropped from the template but not from
the template provider. These are artifacts from relating to that patch
and are no longer used.

Change-Id: I1be7ef288d37f338e83dab3cf041e628a06608d2
2018-03-21 17:07:18 -05:00
Stephen Niedzielski 18f5c3d060 Fix: erroneous build product diffs
When resources/dist was removed or modified, the diff check erroneously
complained that the resources differed. This could be resolved by simply
running the tests again. This patch fixes the issue by leveraging Git to
do the diffs which eliminates the need for a temporary test-build
directory and has the side-effect of improving the grep experience for
the repo.

Change-Id: Idf33f4d52aab6a2907debf6a7d6c7be5c83d9ee6
2018-03-21 08:08:14 -05:00
Stephen Niedzielski e284163014 Hygiene: use consistent ESLint severity syntax
Bug: T165036
Change-Id: I43a500fceb8179d30240dbec8ed56f8d4c7551e9
2018-03-21 10:45:09 +00:00
Stephen Niedzielski 0bee0906d4 Hygiene: replace var with let and const
eslint \
    --cache \
    --max-warnings 0 \
    --report-unused-disable-directives \
    --fix \
    src tests

Change-Id: I051275126ae7fa9affd16c2504017c0584f2d9c7
2018-03-20 14:14:02 -05:00
Stephen Niedzielski 5872c8376d Fix: JSDoc Node.js file copy bug
Upgrade JSDoc from v3.4.3 to 3.5.5:
- v3.5.0 JSDoc can parse any JavaScript that is supported by Babel
  compiler.
- v3.5.1 fixes an incompatibility bug in Node.js < v5.10.0
- v3.5.5 fixes an incompatibility bug in Node.js v8.5.0

Prior to this change, object shorthand caused the following errors:

  jsdoc -c jsdoc.json
  fs.js:1979
    binding.copyFile(src, dest, flags);
            ^

  Error: EISDIR: illegal operation on a directory, copyfile '/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/static/fonts/OpenSans-Bold-webfont.eot' -> 'doc/autogenerated/fonts'
      at Object.fs.copyFileSync (fs.js:1979:11)
      at /home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/publish.js:471:12
      at Array.forEach (<anonymous>)
      at Object.exports.publish (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/publish.js:468:17)
      at Object.module.exports.cli.generateDocs (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:430:39)
      at Object.module.exports.cli.processParseResults (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:383:20)
      at module.exports.cli.main (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:227:14)
      at Object.module.exports.cli.runCommand (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:180:5)
      at /home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/jsdoc.js:103:9
      at Object.<anonymous> (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/jsdoc.js:104:3)
      at Module._compile (module.js:662:30)
      at Object.Module._extensions..js (module.js:673:10)
      at Module.load (module.js:575:32)
      at tryModuleLoad (module.js:515:12)
      at Function.Module._load (module.js:507:3)
      at Function.Module.runMain (module.js:703:10)

https://github.com/jsdoc3/jsdoc/releases/tag/3.5.0
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.1
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.2
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.3
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.4
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.5

Bug: T165036
Change-Id: Ic7a22b6992d45fa0ea3d011a9ad5200d7cc73b80
2018-03-20 09:24:06 -05:00
Stephen Niedzielski 3c3f162226 Fix: pin package versions to patch revision
CI doesn't use a version of NPM that reads package-lock files which
seems to break some build product diff checks.

Bug: T165036
Change-Id: I29383c1a5c1f7f102fe458ac778adc3bf264c9fd
2018-03-20 09:22:43 -05:00
Stephen Niedzielski 42816702eb Hygiene: replace Mustache templates w/ ES6 strings
Replace Mustache.js templates with template literals. An effort was made
to minimize additional refactoring, so feel free to ask for more but it
ain't coming in this PS.

Bug: T165036
Change-Id: I4a6a1d93a2922c3a9ef3ae93c47da17a35c644f0
2018-03-20 08:06:02 -05:00
Stephen Niedzielski e5df865d51 Hygiene: enable Babel transpilation
Enable the Babel transpiler so that ES6 template literals,
destructuring, and arrow functions can be used in production.
"last n versions" syntax was not used so that builds are more
reproducible.

Bug: T165036
Change-Id: I553b6d14cc368c7b4366f68d13038c3d505f5429
2018-03-20 07:59:14 -05:00
Stephen Niedzielski d35286a064 Update: upgrade to Webpack 4 & improve output size
Upgrade from Webpack v2.0.12 to v4.1.1. There have been many changes to
Webpack... Noticeable in the bundle size is that a number of files are
now inlined and generally minification is improved.

Changes related to the upgrade include:

- Remove unsupported UglifyJS options which link back to T188081. These
  appear to have been anticipatory but never acted on and it isn't clear
  whether they even worked or not.
- Pass the -p plag for production optimizations; pass the -d flag since
  production doesn't support watching.
- NamedModulesPlugin is now on by default but only in development mode
  so no change was made.
- Webpack command line client now must be installed separated and
  appears in package.json as webpack-cli.

https://github.com/webpack/webpack/releases/tag/v2.2.0
https://github.com/webpack/webpack/releases/tag/v2.2.1
https://github.com/webpack/webpack/releases/tag/v2.3.0
https://github.com/webpack/webpack/releases/tag/v2.3.1
https://github.com/webpack/webpack/releases/tag/v2.3.2
https://github.com/webpack/webpack/releases/tag/v2.3.3
https://github.com/webpack/webpack/releases/tag/v2.4.0
https://github.com/webpack/webpack/releases/tag/v2.4.1
https://github.com/webpack/webpack/releases/tag/v2.5.0
https://github.com/webpack/webpack/releases/tag/v2.5.1
https://github.com/webpack/webpack/releases/tag/v2.6.0
https://github.com/webpack/webpack/releases/tag/v2.6.1
https://github.com/webpack/webpack/releases/tag/v3.0.0
https://github.com/webpack/webpack/releases/tag/v3.1.0
https://github.com/webpack/webpack/releases/tag/v3.2.0
https://github.com/webpack/webpack/releases/tag/v3.3.0
https://github.com/webpack/webpack/releases/tag/v3.4.0
https://github.com/webpack/webpack/releases/tag/v3.4.1
https://github.com/webpack/webpack/releases/tag/v3.5.0
https://github.com/webpack/webpack/releases/tag/v3.5.1
https://github.com/webpack/webpack/releases/tag/v3.5.2
https://github.com/webpack/webpack/releases/tag/v3.5.3
https://github.com/webpack/webpack/releases/tag/v3.5.4
https://github.com/webpack/webpack/releases/tag/v3.5.5
https://github.com/webpack/webpack/releases/tag/v3.5.6
https://github.com/webpack/webpack/releases/tag/v3.6.0
https://github.com/webpack/webpack/releases/tag/v3.7.0
https://github.com/webpack/webpack/releases/tag/v3.7.1
https://github.com/webpack/webpack/releases/tag/v3.8.0
https://github.com/webpack/webpack/releases/tag/v3.8.1
https://github.com/webpack/webpack/releases/tag/v3.9.0
https://github.com/webpack/webpack/releases/tag/v3.9.1
https://github.com/webpack/webpack/releases/tag/v3.10.0
https://github.com/webpack/webpack/releases/tag/v3.11.0
https://github.com/webpack/webpack/releases/tag/v4.0.0
https://medium.com/webpack/webpack-4-released-today-6cdb994702d4
https://github.com/webpack/webpack/releases/tag/v4.0.1
https://github.com/webpack/webpack/releases/tag/v4.1.0
https://github.com/webpack/webpack/releases/tag/v4.1.1

Bug: T165036
Change-Id: Ic146e680d368fee7ee207b484460ce94f8bd7283
2018-03-20 07:55:37 -05:00
Stephen Niedzielski 4eb9c0efa8 Hygiene: move SVG string to file
- Add SVG Inline Loader for Webpack. This allows SVG files to be
  imported.

- Update the Webpack and test configurations to use the new loader.

- Scope the ESLint rules down to just JavaScript files so that linting
  isn't attempted on the SVG.

Bug: T165036
Change-Id: I00bccff4c3167975c19d577be6343dcaca7ddb2d
2018-03-14 12:04:28 -07:00
Jan Drewniak 1e946a379d Custom page preview for disambiguation pages
Creating a different page preview for disambiguation pages.

This patch:
- modifies the Preview model to accept a new 'type' property
- modifies the Restbase Gateway to pass the 'type' prop to the Preview model
- creates a new template to accept both generic/disambig previews
- modifies the renderer to render the new template
- generates icons for new template through resource loader
- adds new i18n strings
- modifies event-logging "preview seen" event to send new "disambiguation" previewType
- updates event logging schema version
- adds tests for Preview model and renderer for new preview type
- does way too much? yes, yes it does.

Bug: T168392
Change-Id: Idc936cc3eabbdd99a3d98f43c66b4cdbb7d24917
2018-03-14 11:24:26 -07:00
Stephen Niedzielski e9e3d59232 Hygiene: only report diff status
When the diff test fails, don't dump 40k characters to console. Just
report that the failure occurred.

Change-Id: I1cc31fcdebe3e1097ed9e80dfbe3fb6e0dfc34b2
2018-03-07 13:58:08 -06:00
Stephen Niedzielski e406d4556f Fix: don't assume thumbnail URLs contain pixel size
Don't assume that thumbnail URLs contain a dimension delimiter of "px-".
Previously, thumbnail URLs always contained the width. e.g.:

  https://upload.wikimedia.org/wikipedia/commons/a/aa/100px-Red_Giant_Earth_warm.jpg

However, thumbnail URLs that actually point to the original are not
sizable:

  https://upload.wikimedia.org/wikipedia/commons/a/aa/Red_Giant_Earth_warm.jpg

These are provided, for example, when the thumbnail size requested is
larger than the original. There was code designed to handle this
scenario but it only applies when RESTBase and page preview thumbnail
sizes happen to be in sync. In other words, if RESTBase requests a large
thumbnail on behalf of page previews, and page previews only requested a
small thumbnail, the original may be unexpectedly provided. A
conditional is introduced in this patch to verify that "px-" is actually
detected. If it is not present, the original is used.

Bug: T187955
Change-Id: If4e29dd870aecd6d461cc8203f6576d1bb8844f2
2018-02-22 12:36:30 -06:00
Jan Drewniak f4d04b95b6 Updating mw-node-qunit to v3
Fixes tests for sinon v4, which is a dependency of mw-node-qunit v3.

Bug: T180255
Change-Id: I8c7b703f81140e06546aa954f98b8766f5225ff5
2018-02-08 12:20:52 +01:00
Ed Sanders 998d7c4f22 build: Update linters
Change-Id: I1af64c55fdd26a2923a1ec20500e97ea13d92bc8
2018-02-04 22:09:45 +00:00
Stephen Niedzielski 7da20008c0 Hygiene: add bundlesize test
This patch adds a production build output gzipped file size check to the
test script so that any future changes may only introduce known size
differences. Note:

• The initial limit was taken from the present gzipped file size rounded
  up to the 10th of a kibibyte.

• JEDEC notation is used. bundlesize internally uses Bytes utility which
  only supports base 2 units.

  https://github.com/visionmedia/bytes.js

Bug: T176211
Change-Id: Ie95f388673b0b982b105fef9a2917513a3307060
2018-01-30 20:04:06 +00:00
joakin 122332c66b Test: Update the test runner dependency
To 2.2 which just updates minor versions of dependencies (jsdom, sinon,
qunit).

See https://github.com/joakin/mw-node-qunit/blob/master/CHANGELOG.md#220

Change-Id: I26e6b060b0124d9f91aaa7ccc1d8be1981e5de1e
2017-11-10 17:10:59 +01:00
Ed Sanders 7f4dd1159b build: Update eslint and other linters
Change-Id: I0a20ad5d16d46afbc2a328f8e254295972f58ab0
2017-10-09 15:56:15 +01:00
jenkins-bot 2296b3578e Merge "Use EcmaScript modules instead of common.js modules" 2017-08-07 22:13:51 +00:00
Antoine Musso b60eedc8da build: drop grunt-cli
grunt 1.x now includes a CLI command, hence grunt-cli is no more needed.

Change-Id: I94f0c66236b5f0f12220741276c7fe24a89c65e0
2017-08-01 10:47:44 +02:00
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 eb877a4af5 Deps: Upgrade mw-node-qunit
Version 2.1.0 had a bug because of using console.err, obfuscating error
messages when the cli runner errored out.

Bug: T171951
Change-Id: I263c3e4e13f55cf67630448119ff335e26085197
2017-07-31 19:14:08 +00:00
Antoine Musso 46e0d7cdbe Define npm peer dependency explicitly
npm 3 requires dependencies to be explicitly defined.

Bug: T172094
Change-Id: Ic640ccf0f577e47036d473892522ea758014fab4
2017-07-31 13:31:35 +02:00
joakin 9ed1703cf8 Test: Upgrade mw-node-qunit and use globs
To get cross-shell and OS glob support and fix some of the sinon
deprecation warnings regarding getConfig.

Bug: T168054
Change-Id: Idd6d47c1e63836c8429156cd9030ef9fda4479b1
2017-06-16 14:50:19 +02:00
joakin 8f408e2937 Fix the npm script test:node
npm scripts are run under sh. globstar support is only available in bash
> 4 with globstar enabled, so **/*.js was actually being resolved to
*/*.js only running tests 2 directories deep.

This made the test mediawiki.test.js not run since it was moved to the
3rd level deep folder (and actually broke), resulting in:

  208 tests
  403 passed

With this change, it fixes getting the test files, and fixes the
mediawiki.test.js, resulting in:

  215 tests
  413 passed

instead.

This makes it work everywhere and as nested as it will get for now. Will
consider adding glob support to mw-node-qunit later for easier use in
other projects too.

Bug: T165018
Change-Id: Id0164b2673c8afe8a24fd0eb4aa255c134253862
2017-06-16 14:49:33 +02:00
jenkins-bot d98cc50275 Merge "Tools: Upgrade webpack to 2.6" 2017-05-31 19:17:58 +00:00
jdlrobson e21a640002 Run doc generation on npm test
The benefit of this is if there are any problems with the
documentation they will not enter our codebase.

We do a similar thing in MobileFrontend

Bug: T158236
Change-Id: I30329dd868fe596c490f95354c3226c9cd4a2fc7
2017-05-26 10:26:35 -07:00
Sam Smith 4eae6aebb3 doc: Add doc:start script
Like npm run start, npm run doc:start will rebuild the documentation if
any file in the src directory changes.

Supporting changes:
* Use nodemon@1.11.0.

Change-Id: I7b528525874e377533e92c0a80c8aae9f6a18620
2017-05-25 15:21:15 +00:00
joakin d96be0384f Tools: Upgrade webpack to 2.6
To benefit from the bugfixes

See https://github.com/webpack/webpack/releases

Change-Id: Ia4a10c821d6dc4257bfea57658cf16d1ac028bf4
2017-05-23 20:28:23 +02:00
joakin 86c2edcf76 Deps: Upgrade mw-node-qunit
v2 updates it's dependencies itself, latest jsdom, qunit, sinon and
jquery

Change-Id: I52e9751e457100484133585b253e93b66bfee162
2017-05-23 20:20:27 +02:00
Sam Smith d9db2eb9a2 doc: Replace JSDuck v5.3.4 with JSDoc v3.4.3
JSDoc can handle ES2015 modules whereas JSDuck can't. Regardless of
however many features JSDuck has that JSDoc mightn't [0], we can't
use JSDuck to document this codebase.

[0] T138401

Bug: T158236
Change-Id: I8da712075dd28f6b228c96fa9577ca39eb148fb5
2017-05-23 05:33:31 +01:00
joakin a480b997d4 Tools: Add pre-commit git hook to auto test and build
That way before commits it will run tests and add compiled sources
automatically removing some of the pain of having to commit the compiled
assets for now.

Additional changes:
* Extract npm test:dev from npm test to run lint and tests without the
  CI check (to be re-used in the pre-commit hook)

Bug: T160061
Change-Id: I6e1201ef7dae5fef34b14cabc0292fb1aa4e5997
2017-05-11 10:37:48 +02:00
joakin 7bd29bb058 Enable production settings for the production bundle
It enables certain optimizations, see:
* https://webpack.js.org/guides/production-build/

Code is minified by uglifyjs.

Aditional changes:
* Add banner so that sources are not minified by ResourceLoader

Bug: T160061
Change-Id: I50c9148ebf2d860db42a24225bc128bfcfe56927
2017-05-11 10:37:45 +02:00
Ed Sanders 81a6d49e99 build: Update eslint to 0.4.0 and make pass
Change-Id: I7d301049f0c91f79e82f996b2dce770840c27e72
2017-05-05 05:43:16 +01:00
joakin 841c69ba2e Tests: Remove grunt-contrib-qunit
There are no browser qunit tests right now, and if they are added at
some point they should use core's infrastructure to run the tests like
in mobilefrontend for example.

Bug: T160406
Change-Id: I4346a891bc1fdb9252ebef593312911031cf2287
2017-04-26 12:34:12 +02:00
Ed Sanders c46b1c8db3 build: Update stylelint to 0.4.1
Change-Id: I143662a36bf5d79cfc5b35ec62c3473f91afd14c
2017-03-20 14:50:42 +00:00
joakin eff14acbba Tooling: Use latest stable webpack
Webpack 1.14.0 is an old version, switch to using latest stable which
has better documentation, tree shaking, ES2015 modules and a core team
of contributors with funding. See https://webpack.js.org/

Additional changes:
* Recompile the frontend assets

Change-Id: I2c5940276e99dee104d04c6a0b83d8ab36a99df5
2017-03-08 19:27:40 +01:00
joakin 04fbc9dea2 Add code coverage reports npm script
Generate code coverage reports based on the node-qunit tests with
istanbul.

Changes:
* Update README with npm run coverage
* Add .istanbul.yml to configure istanbul
* Add npm script "coverage" that runs istanbul and generates the reports

Example report: http://popups-coverage.surge.sh/lcov-report/index.html

Change-Id: I9be8c04b858a3ce6f4e29af2685b79253e3b4dca
2017-03-03 13:34:33 +01:00
joakin facf307918 Tooling: Make diffing in check-built-assets verbose
So that it is easier to diagnose what the differences are between the
commited built files and the ones compiled for the check.

Change-Id: Id5394bda910c8218123a87d4604351fe5ae95d1e
2017-03-02 16:18:13 +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
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 c593ed3502 CI: Check built assets are up to date with sources
When running the CI npm job in jenkins, make sure to check that the
compiled assets from the bundler are up to date with the sources.

That way, CI will not verify if the assets commited are not up to date
so that we don't have out-of-sync sources and built assets.

Change-Id: I56bc0097f5b4fa6c9b7afa3ae14b7db4ab480a94
2017-02-14 18:39:38 +01:00
joakin 45046da7f1 Tooling: Add npm start script for development mode
Run webpack in watch mode for development. Scripts are documented in
a followup commit in the README.

Change-Id: Id1e2f8b8578169eee53a5e4f8c468d5426d4c2ea
2017-02-14 18:39:38 +01:00
jdlrobson f0f462ee0d Redux and redux-thunk now packaged inside ext.popups
Until this appears in core it makes sense to package it up as
part of ext.popups resource loader module.

Version numbers from npm are pinned to exact versions to control the
upgrade path of the libraries instead of leaving it to semver on
developers machines.

Bug: T156333
Change-Id: I33368ecc3c8e911d96f846669bcd831c182749f2
2017-02-13 14:15:30 +01:00
jdlrobson 49df4b9572 Tooling: Begin to use webpack for JS code generation
Generate changeListeners via webpack
We now use a build folder to build the JavaScript for
our ResourceLoader modules. This is the first change
in a line of changes.
A source map is provided for debug support.

Bug: T156333
Change-Id: I771843d1ddb4b50adedc3fa53b30c2f1d8a76acb
2017-02-13 13:42:22 +01:00
joakin 4ca333e577 Remove jshint/jscs, add eslint and stylelint
...with the wikimedia presets.

For automatically fixing most of the JS lint problems run

      grunt eslint:fix

Some rules of stylelint were disabled given they cause problems with
existing popups code (like no id selectors for example).

Change-Id: I2153047c3ddbea50572dd329989088bb20787515
2016-12-16 13:35:34 +01:00
jhobs 046d12f51b Update linting and enable command line QUnit
You can use `grunt watch` now!

Changes:
 * Re-enable QUnit (but ignore legacy tests)
 * Add a sample QUnit test
 * Add ability to run QUnit via `grunt watch` or `grunt test`
 * Move linting to `grunt lint` task
 * Add Redux to globals in linter

Change-Id: Ie4a65a8a66773d6472b3d73257267d18027ff3c3
2016-11-08 13:56:17 -05:00
Kunal Mehta 15336e307a build: Updating development dependencies
* grunt-jsonlint: 1.0.5 → 1.0.7

Change-Id: I0fd966cf85bf636e6f91b86582c53bcb833561dc
2015-12-29 11:48:27 -08:00
Paladox a39af9b58e build: Updating development dependencies
* grunt-contrib-jshint: 0.11.2 → 0.11.3
* grunt-jsonlint: 1.0.4 → 1.0.5

Change-Id: Ide62f02ded3a74b94454fd98d4ca7b9f20470883
2015-10-26 08:58:24 +00:00
Kunal Mehta 8b27b96d3a build: Updating development dependencies
* grunt-banana-checker: 0.2.2 → 0.4.0

Change-Id: I40eacb11872f82d23c7324237fa7b1c78b11dd3a
2015-10-11 11:56:05 -04:00
Prateek Saxena 6eef4f325b Add jscs and jshint tasks to the Gruntfile
Adds the jscs and jshint packages for development and their tasks in
Grunt. Also fixes all the code convention errors.

Change-Id: If1c9dfdbe22d4912d78b6a51b1292866970a85cc
2015-09-04 13:57:52 +05:30
Prateek Saxena 07d76da27e Setup jsduck to run on 'npm run doc'
Change-Id: If49922acd1d8af9caac54ed46360ff6c780833ce
2015-08-03 15:54:25 +05:30
Kunal Mehta 47d5daf74d build: Configure banana-checker and jsonlint
Change-Id: Id3f1d601f6b99e9646c7a1c6b430b1dd777e952b
2015-06-19 22:09:03 -07:00