Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Move linting from `test` to a test prerequisite, the `pretest` script. - Add Mocha `test` and `test:watch` scripts: - Tests are permitted in test/ and src/ per ticket requirements. However, it's unclear why they'd be wanted in both. The test/ directory was also added to format and lint scripts. - A throwaway test was added since the absence of all tests causes a failure and to show that the setup works. - Add Mocha, Sinon.JS, and Chokidar CLI to `devDependencies`: - Mocha is used because that's what Services and Readers' Infrastructure use and it's quite popular. - Sinon.JS is used because MobileFrontend uses it and Readers' Infrastructure is considering it (T151091*) and it's popular too. - Chokidar CLI (chokidar-cli) was chosen because it's popular, quick, and Chokidar is used by Live Server (live-server). watch and npm-watch were each tried but appeared to function sporadically and slowly on Ubuntu GNOME v17.04. `npm test -- -w` cannot be used because 1) continuous linting is also wanted, 2) [new files are not observed], 3) a maintainer indicated they were wanted to get rid of watch functionality in the same report, and 4) separating watch and testing responsibilities gives more flexibility in responding to file changes. No attempts were made to filter or throttle files observed. *The [Services team template] and most of the [Readers' Infrastructure repos] do not reference it. [Services team template]: https://github.com/wikimedia/service-template-node/blob/3842da2/package.json [Readers' Infrastructure repos]: as described on: - https://www.mediawiki.org/wiki/Wikimedia_Reading_Infrastructure_team#Projects - https://www.mediawiki.org/wiki/Reading/Component_responsibility And discovered with: $ find -not \( \( -name .git -o -name node_modules -o -name i18n -o -name sinonjs -o -name bundle -o -name .bundle \) -prune \) -type f| xargs -rd\\n grep -El 'sinon|\.(calledOn|calledWith|spy)\(' mediawiki/tests/qunit/... mediawiki/extensions/MobileFrontend/... mediawiki/extensions/MultimediaViewer/... mediawiki/extensions/TimedMediaHandler/... [new files are not observed]: mochajs/mocha#2176 - A Mocha ESLint environment was deliberately omitted to force tests to explicitly specify their dependencies even though the Mocha API is a global. Bug: T172432
- Loading branch information