test(pre): initial cli/integration suite
This commit is contained in:
		
							parent
							
								
									6d84b66c05
								
							
						
					
					
						commit
						c6f95e4870
					
				
							
								
								
									
										11
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								package.json
									
									
									
									
									
								
							| @ -29,12 +29,12 @@ | ||||
|     "mkdirp": "^0.5.1", | ||||
|     "nixt": "^0.4.1", | ||||
|     "nock": "^2.5.0", | ||||
|     "nyc": "^2.3.0", | ||||
|     "npm-registry-couchapp": "^2.6.11", | ||||
|     "nyc": "^3.0.0", | ||||
|     "proxyquire": "^1.5.0", | ||||
|     "rimraf": "^2.4.0", | ||||
|     "standard": "^4.2.1", | ||||
|     "tap": "^1.2.0" | ||||
|     "tap": "^1.3.1" | ||||
|   }, | ||||
|   "homepage": "https://github.com/semantic-release/core#readme", | ||||
|   "keywords": [ | ||||
| @ -59,9 +59,10 @@ | ||||
|     "build:tests": "rimraf .test && mkdirp .test && babel test --out-dir .test", | ||||
|     "coverage": "nyc report", | ||||
|     "coverage:upload": "npm run coverage -- --reporter=lcovonly && coveralls < coverage/lcov.info", | ||||
|     "pretest:suite": "npm run build && npm run build:tests", | ||||
|     "test": "npm run test:style && npm run test:suite", | ||||
|     "pretest:unit": "npm run build && npm run build:tests", | ||||
|     "test": "npm run test:style && npm run test:unit && npm run test:integration", | ||||
|     "test:integration": "tap --no-cov .test/scenarios/*.js", | ||||
|     "test:style": "standard", | ||||
|     "test:suite": "nyc tap --no-cov .test/{scenarios,specs}/*.js" | ||||
|     "test:unit": "nyc tap --no-cov .test/specs/*.js" | ||||
|   } | ||||
| } | ||||
|  | ||||
							
								
								
									
										89
									
								
								test/scenarios/pre.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								test/scenarios/pre.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,89 @@ | ||||
| const { join } = require('path') | ||||
| 
 | ||||
| const { test, tearDown } = require('tap') | ||||
| const rimraf = require('rimraf') | ||||
| 
 | ||||
| const registry = require('../registry') | ||||
| const testModule = require('../lib/test-module') | ||||
| const baseScenario = require('../lib/base-scenario') | ||||
| 
 | ||||
| test('change version', (t) => { | ||||
|   t.plan(7) | ||||
| 
 | ||||
|   registry.start((err) => { | ||||
|     t.error(err, 'registry started') | ||||
|     if (err) t.bailout('registry not started') | ||||
| 
 | ||||
|     testModule('change-version', (err, cwd) => { | ||||
|       t.error(err, 'test-module created') | ||||
|       if (err) t.bailout('test-module not created') | ||||
| 
 | ||||
|       t.test('no version', (tt) => { | ||||
|         tt.plan(1) | ||||
| 
 | ||||
|         baseScenario(cwd, registry.uri) | ||||
|           .run('node ../../../bin/semantic-release.js pre') | ||||
|           .stderr(/ENOCHANGE/) | ||||
|           .code(1) | ||||
|           .end(tt.error) | ||||
|       }) | ||||
| 
 | ||||
|       t.test('initial version', (tt) => { | ||||
|         tt.plan(1) | ||||
| 
 | ||||
|         baseScenario(cwd, registry.uri) | ||||
|           .exec('git commit -m "feat: initial" --allow-empty') | ||||
|           .exec('node ../../../bin/semantic-release.js pre') | ||||
|           .run('npm publish') | ||||
|           .stdout(/1\.0\.0/) | ||||
|           .code(0) | ||||
|           .end(tt.error) | ||||
|       }) | ||||
| 
 | ||||
|       t.test('patch version', (tt) => { | ||||
|         tt.plan(1) | ||||
| 
 | ||||
|         baseScenario(cwd, registry.uri) | ||||
|           .exec('git commit -m "fix: foo" --allow-empty') | ||||
|           .exec('node ../../../bin/semantic-release.js pre') | ||||
|           .run('npm publish') | ||||
|           .stdout(/1\.0\.1/) | ||||
|           .code(0) | ||||
|           .end(tt.error) | ||||
|       }) | ||||
| 
 | ||||
|       t.test('feature version', (tt) => { | ||||
|         tt.plan(1) | ||||
| 
 | ||||
|         baseScenario(cwd, registry.uri) | ||||
|           .exec('git commit -m "feat: foo" --allow-empty') | ||||
|           .exec('node ../../../bin/semantic-release.js pre') | ||||
|           .run('npm publish') | ||||
|           .code(0) | ||||
|           .stdout(/1\.1\.0/) | ||||
|           .end(tt.error) | ||||
|       }) | ||||
| 
 | ||||
|       t.test('breaking version', (tt) => { | ||||
|         tt.plan(1) | ||||
| 
 | ||||
|         baseScenario(cwd, registry.uri) | ||||
|           .exec('git commit -m "feat: foo\n\n BREAKING CHANGE: bar" --allow-empty') | ||||
|           .exec('node ../../../bin/semantic-release.js pre') | ||||
|           .run('npm publish') | ||||
|           .code(0) | ||||
|           .stdout(/2\.0\.0/) | ||||
|           .end(tt.error) | ||||
|       }) | ||||
|     }) | ||||
|   }) | ||||
| }) | ||||
| 
 | ||||
| tearDown(() => { | ||||
|   function cb (err) { | ||||
|     if (err) console.log(err) | ||||
|   } | ||||
| 
 | ||||
|   rimraf(join(__dirname, '../tmp'), cb) | ||||
|   registry.stop(cb) | ||||
| }) | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user