test(ignore): ignore pack and link commands as well

This commit is contained in:
Stephan Bönnemann 2015-04-21 14:12:27 +02:00
parent d4f6ee0d6a
commit 36f5555d8e
3 changed files with 38 additions and 34 deletions

View File

@ -4,7 +4,7 @@ var test = require('tape')
var createModule = require('./lib/create-module') var createModule = require('./lib/create-module')
require('./scenarios/install')(test, createModule) require('./scenarios/ignore')(test, createModule)
require('./scenarios/prepublish')(test, createModule) require('./scenarios/prepublish')(test, createModule)
require('./scenarios/postpublish')(test, createModule) require('./scenarios/postpublish')(test, createModule)
require('./scenarios/publish')(test, createModule) require('./scenarios/publish')(test, createModule)

37
tests/scenarios/ignore.js Normal file
View File

@ -0,0 +1,37 @@
'use strict'
var fs = require('fs')
var efh = require('error-first-handler')
var nixt = require('nixt')
module.exports = function (test, createModule) {
createModule(efh()(function (name, cwd) {
test('ignore', function (t) {
ignoreTest(t, 'npm install', 'not doing anything when the module is installed')
ignoreTest(t, 'npm i', 'not doing anything when the module is installed with abbrevd command')
ignoreTest(t, 'npm link', 'not doing anything when the module is linked')
ignoreTest(t, 'npm lin', 'not doing anything when the module is linked with abbrevd command')
ignoreTest(t, 'npm pack', 'not doing anything when the module is packed')
ignoreTest(t, 'npm pa', 'not doing anything when the module is packed with abbrevd command')
})
function ignoreTest (t, command, name, last) {
t.test(name, function (t) {
t.plan(2)
var pkg = fs.readFileSync(cwd + '/package.json')
nixt()
.cwd(cwd)
.run(command)
.code(0)
.stdout(/> semantic-release pre\n$/m)
.end(function (err) {
t.is(pkg + '', fs.readFileSync(cwd + '/package.json') + '', 'package')
t.error(err, 'nixt')
})
})
}
}))
}

View File

@ -1,33 +0,0 @@
'use strict'
var fs = require('fs')
var efh = require('error-first-handler')
var nixt = require('nixt')
module.exports = function (test, createModule) {
createModule(efh()(function (name, cwd) {
test('install', function (t) {
installTest(t, 'npm install', 'not doing anything when the module is installed')
installTest(t, 'npm i', 'not doing anything when the module is installed with abbrevd command')
})
function installTest (t, command, name, last) {
t.test(name, function (t) {
t.plan(2)
var pkg = fs.readFileSync(cwd + '/package.json')
nixt()
.cwd(cwd)
.run(command)
.code(0)
.stdout(/> semantic-release pre\n$/m)
.end(function (err) {
t.is(pkg + '', fs.readFileSync(cwd + '/package.json') + '', 'package')
t.error(err, 'nixt')
})
})
}
}))
}