diff --git a/tests/index.js b/tests/index.js index b5ea3638..618a5e70 100644 --- a/tests/index.js +++ b/tests/index.js @@ -4,7 +4,7 @@ var test = require('tape') var createModule = require('./lib/create-module') -require('./scenarios/install')(test, createModule) +require('./scenarios/ignore')(test, createModule) require('./scenarios/prepublish')(test, createModule) require('./scenarios/postpublish')(test, createModule) require('./scenarios/publish')(test, createModule) diff --git a/tests/scenarios/ignore.js b/tests/scenarios/ignore.js new file mode 100644 index 00000000..3f5537ac --- /dev/null +++ b/tests/scenarios/ignore.js @@ -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') + }) + }) + } + })) +} diff --git a/tests/scenarios/install.js b/tests/scenarios/install.js deleted file mode 100644 index ea78cfe8..00000000 --- a/tests/scenarios/install.js +++ /dev/null @@ -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') - }) - }) - } - })) -}