This task tracks the work add Core as a dependency of the npm test job for Vector.
Vector runs a growing number of tests via it's NPM test script. Some of these tests have relative references to various files in Core. For example, here's the current Storybook setup script at time of writing:
#!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' mkdir -p .storybook/resolve-less-imports/mediawiki.ui mkdir -p docs/ui/assets/ curl -sS "https://en.wikipedia.org/w/load.php?only=styles&skin=vector&debug=true&modules=ext.echo.styles.badge|ext.uls.pt|wikibase.client.init|mediawiki.skinning.interface" -o .storybook/integration.less curl -sSL "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.less/mediawiki.mixins.less?format=TEXT" | base64 --decode > .storybook/resolve-less-imports/mediawiki.mixins.less curl -sSL "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.less/mediawiki.ui/variables.less?format=TEXT" | base64 --decode > .storybook/resolve-less-imports/mediawiki.ui/variables.less curl -sSL "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.less/mediawiki.mixins.rotation.less?format=TEXT" | base64 --decode > .storybook/resolve-less-imports/mediawiki.mixins.rotation.less curl -sSL "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/resources/src/mediawiki.less/mediawiki.mixins.animation.less?format=TEXT" | base64 --decode > .storybook/resolve-less-imports/mediawiki.mixins.animation.less curl -sS "https://en.m.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg" -o "docs/ui/assets/wordmark.svg" curl -sS "https://en.m.wikipedia.org/static/images/mobile/copyright/wikipedia.png" -o "docs/ui/assets/icon.png" curl -sS "https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-tagline-en.svg" -o "docs/ui/assets/tagline.svg"
These curl commands could be replaced with symlinks, copies, or otherwise local file references if the NPM CI job (currently mwgate-node10-docker) had MediaWiki Core in its environment.
Another use case is for when reference types via Vector's type checker. For example:
typeof import( '../../resources/src/mediawiki.page.ready/mediawiki.page.ready/checkboxHack.js' );
References
- @Krinkle suggested reviewing the qunit, phpunit, selenium jobs as they all have a dependency on MediaWiki Core and know how to handle Depends-On patches and such.
- WikibaseMediaInfo clones a full copy of MediaWiki into its NPM packages directory (node_modules). It's possible that repo could benefit from the approach taken by this task but it's out of scope.
Acceptance criteria
- curl file references can be replaced with relative references that work locally in the context of a MediaWiki install in CI.
- In general, ls ../../resources/src from an NPM script returns all the usual mediawiki.* files.