Page MenuHomePhabricator

[4h] Share build and test script from package.json
Closed, ResolvedPublic

Description

We reuse the test scripts identically compared to data-bridge and termbox apart from the names in the no-diff script.
E.g. https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/3fdc9580a77cc792777dbbfe7eb427871341f212/view/lib/wikibase-tainted-ref/package.json#L15

We should sure all the committed built files are tested for differences.

We should make sure all files resulting from the build are used and if needed tested. i.e. there shouldn't be files make that we then ignore.

We should look for an off the shelf solution to check that the above criteria are true.
If that isn't possible we should at least refactor the test:nodiff command to not be a a multiline bash script tucked in package.json (i.e. put it somewhere, parameterise it etc...)

Event Timeline

WMDE-leszek renamed this task from Share build and test script from package.json to [4h] Share build and test script from package.json.Jan 22 2020, 11:46 AM

Seems there isn't an obvious off the shelf solution for this. This closest thing I found was perhaps: https://github.com/smikula/webpack-bundle-diff or even https://github.com/mixer/webpack-bundle-compare but these are not at all for diffing to find any differences but more for comparison work.

I spent some time tying to build a small script to nicely automate this in JS. My plan was to try and use vue-cli to run a build progrmatically into e.g. /tmp:
inspect all the files in the output and diff each of those individually with what was committed.

I spent a little time trying to call vue-cli programatically but sadly this looks like a feature that will only be there in vue3. See: https://github.com/vuejs/vue-cli/issues/748

I'm now going to work on implementing basically the same thing in bash.

Change 570876 had a related patch set uploaded (by Tarrow; owner: Tarrow):
[mediawiki/extensions/Wikibase@master] TR: Bash script for diffing webpack

https://gerrit.wikimedia.org/r/570876

Change 570876 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] TR: Bash script for diffing webpack

https://gerrit.wikimedia.org/r/570876