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
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
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
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
To get cross-shell and OS glob support and fix some of the sinon
deprecation warnings regarding getConfig.
Bug: T168054
Change-Id: Idd6d47c1e63836c8429156cd9030ef9fda4479b1
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
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
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
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
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
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
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
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
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
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
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
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
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
Run webpack in watch mode for development. Scripts are documented in
a followup commit in the README.
Change-Id: Id1e2f8b8578169eee53a5e4f8c468d5426d4c2ea
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
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
...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
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
Adds the jscs and jshint packages for development and their tasks in
Grunt. Also fixes all the code convention errors.
Change-Id: If1c9dfdbe22d4912d78b6a51b1292866970a85cc