diff options
author | Simen Bekkhus <sbekkhus91@gmail.com> | 2018-03-21 18:20:47 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2018-04-11 04:23:19 +0300 |
commit | 8a1a64203cca3f30999ea9e160eb63662478dcee (patch) | |
tree | b12e1217312fdb14b586135ac9ee5a6ae8c0b8ef | |
parent | ab489b75362348f412c002cf795a31dea6420ef0 (diff) |
npm: add npm cit command
PR-URL: https://github.com/npm/npm/pull/20126
Credit: @SimenB
Reviewed-By: @iarna
-rw-r--r-- | doc/cli/npm-install-ci-test.md | 16 | ||||
-rw-r--r-- | lib/config/cmd-list.js | 4 | ||||
-rw-r--r-- | lib/install-ci-test.js | 26 |
3 files changed, 45 insertions, 1 deletions
diff --git a/doc/cli/npm-install-ci-test.md b/doc/cli/npm-install-ci-test.md new file mode 100644 index 000000000..4cbab9144 --- /dev/null +++ b/doc/cli/npm-install-ci-test.md @@ -0,0 +1,16 @@ +# npm install-ci-test(1) -- Install a project with a clean slate and run tests + +## SYNOPSIS + + npm install-ci-test + + alias: npm cit + +## DESCRIPTION + +This command runs an `npm ci` followed immediately by an `npm test`. + +## SEE ALSO + +- npm-ci(1) +- npm-test(1) diff --git a/lib/config/cmd-list.js b/lib/config/cmd-list.js index ebf2b020b..ed5d80759 100644 --- a/lib/config/cmd-list.js +++ b/lib/config/cmd-list.js @@ -6,6 +6,7 @@ var shorthands = { 'ln': 'link', 'i': 'install', 'it': 'install-test', + 'cit': 'install-ci-test', 'up': 'update', 'c': 'config', 's': 'search', @@ -42,7 +43,8 @@ var affordances = { 'remove': 'uninstall', 'rm': 'uninstall', 'r': 'uninstall', - 'rum': 'run-script' + 'rum': 'run-script', + 'sit': 'cit' } // these are filenames in . diff --git a/lib/install-ci-test.js b/lib/install-ci-test.js new file mode 100644 index 000000000..26120f4a2 --- /dev/null +++ b/lib/install-ci-test.js @@ -0,0 +1,26 @@ +'use strict' + +// npm install-ci-test +// Runs `npm ci` and then runs `npm test` + +module.exports = installTest +var ci = require('./ci.js') +var test = require('./test.js') +var usage = require('./utils/usage') + +installTest.usage = usage( + 'install-ci-test', + '\nnpm install-ci-test [args]' + + '\nSame args as `npm ci`' +) + +installTest.completion = ci.completion + +function installTest (args, cb) { + ci(args, function (er) { + if (er) { + return cb(er) + } + test([], cb) + }) +} |