Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
npm: add npm cit command
Browse files Browse the repository at this point in the history
PR-URL: #20126
Credit: @SimenB
Reviewed-By: @iarna
  • Loading branch information
SimenB authored and iarna committed Apr 11, 2018
1 parent b271cdd commit 9493f50
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
16 changes: 16 additions & 0 deletions doc/cli/npm-install-ci-test.md
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 3 additions & 1 deletion lib/config/cmd-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var shorthands = {
'ln': 'link',
'i': 'install',
'it': 'install-test',
'cit': 'install-ci-test',
'up': 'update',
'c': 'config',
's': 'search',
Expand Down Expand Up @@ -42,7 +43,8 @@ var affordances = {
'remove': 'uninstall',
'rm': 'uninstall',
'r': 'uninstall',
'rum': 'run-script'
'rum': 'run-script',
'sit': 'cit'
}

// these are filenames in .
Expand Down
26 changes: 26 additions & 0 deletions lib/install-ci-test.js
Original file line number Diff line number Diff line change
@@ -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)
})
}

0 comments on commit 9493f50

Please sign in to comment.