Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.

Commit fffa399

Browse files
authored
Merge pull request #463 from henningvs/master
Fixes Issue #288 `project swagger test` does not exit with the correct exit code
2 parents 60eb0ab + 70545b0 commit fffa399

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

lib/commands/project/project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function test(directory, options, cb) {
221221
process.env.swagger_mockMode = true;
222222
}
223223
mocha.run(function(failures) {
224-
cb(null, failures);
224+
process.exit(failures);
225225
});
226226
});
227227
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"connect": "^3.3.5",
2424
"debug": "^2.1.3",
2525
"fs-extra": "^0.24.0",
26-
"inquirer": "^0.10.0",
26+
"inquirer": "^1.2.3",
2727
"js-yaml": "^3.3.0",
2828
"lodash": "^3.10.0",
2929
"mocha": "^2.2.1",

test/commands/project/project.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,11 @@ describe('project', function() {
453453

454454
var prevFile = fs.readFileSync(path.resolve(projPath, 'test/api/client/hello-test.js'), {encoding: 'utf8'});
455455

456-
process.nextTick(function mockResponse() {
456+
setTimeout(function mockResponse() {
457457
stdin.send('y\n');
458458
stdin.send('y\n');
459-
});
459+
done();
460+
}, 250);
460461

461462
project.generateTest(projPath, {}, function(err) {
462463
fs.existsSync(path.resolve(projPath, 'test/api/client/hello-test.js')).should.be.ok;
@@ -490,6 +491,7 @@ describe('project', function() {
490491
setTimeout(function () {
491492
stdin.send('n\n');
492493
stdin.send('n\n');
494+
done();
493495
}, 250);
494496

495497
project.generateTest(projPath, {}, function(err) {
@@ -511,6 +513,7 @@ describe('project', function() {
511513

512514
process.nextTick(function mockResponse() {
513515
stdin.send('a\n');
516+
done();
514517
});
515518

516519
project.generateTest(projPath, {}, function(err) {

0 commit comments

Comments
 (0)