[go: up one dir, main page]

Page MenuHomePhabricator

Add a pre-commit hook to run `npm run test`
Closed, ResolvedPublic

Description

The Portals repository should contain a pre-commit hook that runs npm run test command before every commit. This will prevent common linting errors from being submitted to Gerrit.

In other Wikimedia repositories, such as:

Use the pre-commit package for this purpose.

In order to add the pre-commit hook, we need to do the following:

  1. Install the pre-commit package with npm install --save-dev pre-commit
  2. pin the version of pre-commit (remove the ^ before the version number).
  3. Add the pre-commit key with the value test to the package.json file "pre-commit" : [ "test"]
  4. Submit the new package.json and package-lock.json to Gerrit. (When you commit the patch, the pre-commit hook should invoke Gulp.js and pass).

Event Timeline

Change 673768 had a related patch set uploaded (by Ishan Saini; owner: Ishan Saini):
[wikimedia/portals@master] Adds a pre-commit hook to run 'npm run test'

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

Change 673768 merged by jenkins-bot:
[wikimedia/portals@master] Adds a pre-commit hook to run 'npm run test'

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