|
1 | 1 | 'use strict'; |
2 | 2 | var expect = require('chai').expect; |
3 | 3 | var fs = require('fs'); |
| 4 | +var Q = require('q'); |
4 | 5 | var githubRemoveAllReleases = require('github-remove-all-releases'); |
5 | 6 | var shell = require('shelljs'); |
6 | 7 | var spawn = require('child_process').spawn; |
@@ -64,6 +65,40 @@ describe('cli', function() { |
64 | 65 | }); |
65 | 66 | }); |
66 | 67 |
|
| 68 | + it('should work with no releases', function(done) { |
| 69 | + Q.Promise(function(resolve, reject) { |
| 70 | + var cp = spawn(cliPath, ['--pkg', __dirname + '/fixtures/_package.json', '-t', AUTH.token, '-v'], { |
| 71 | + stdio: [process.stdin, null, null] |
| 72 | + }); |
| 73 | + |
| 74 | + cp.on('error', function(code) { |
| 75 | + reject('Process exits with code ' + code); |
| 76 | + }); |
| 77 | + |
| 78 | + cp.on('close', function(code) { |
| 79 | + expect(code).to.equal(0); |
| 80 | + |
| 81 | + resolve(); |
| 82 | + }); |
| 83 | + }).then(function() { |
| 84 | + // we call it a second time, because there no tags are left to create a release from |
| 85 | + var cp = spawn(cliPath, ['--pkg', __dirname + '/fixtures/_package.json', '-t', AUTH.token, '-v'], { |
| 86 | + stdio: [process.stdin, null, null] |
| 87 | + }); |
| 88 | + |
| 89 | + cp.on('error', function(code) { |
| 90 | + done('Process exits with code ' + code); |
| 91 | + }); |
| 92 | + |
| 93 | + cp.on('close', function(code) { |
| 94 | + // this time we also expect the cli to exit with code 0 due to #17 |
| 95 | + expect(code).to.equal(0); |
| 96 | + |
| 97 | + done(); |
| 98 | + }); |
| 99 | + }); |
| 100 | + }); |
| 101 | + |
67 | 102 | it('should print out error message and exit with `1` if all results error', function(done) { |
68 | 103 | var cp = spawn(cliPath, ['--pkg', __dirname + '/fixtures/_package.json', '-t', AUTH.token], { |
69 | 104 | stdio: [process.stdin, null, null] |
|
0 commit comments