test(ignore): ignore pack and link commands as well
This commit is contained in:
		
							parent
							
								
									d4f6ee0d6a
								
							
						
					
					
						commit
						36f5555d8e
					
				| @ -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) | ||||
|  | ||||
							
								
								
									
										37
									
								
								tests/scenarios/ignore.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								tests/scenarios/ignore.js
									
									
									
									
									
										Normal 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') | ||||
|           }) | ||||
|       }) | ||||
|     } | ||||
|   })) | ||||
| } | ||||
| @ -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') | ||||
|           }) | ||||
|       }) | ||||
|     } | ||||
|   })) | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user