Skip to content

Commit

Permalink
Readability and correct exit code
Browse files Browse the repository at this point in the history
 🐿 v2.7.0
  • Loading branch information
adgad committed Apr 13, 2018
1 parent f6fa93f commit 1e559a1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/smoke/smoke-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ class SmokeTest {
errors: results.filter(url => url.errors > 0)
};

const timeTaken = new Date(new Date().getTime() - startTime).toISOString().substr(14, 5);

console.log('--------------------------------');
console.log(chalk`{bold.underline Smoke Test Results}`);
console.log(chalk`{bgBlue URLs tested:} ${totalResults.urlsTested}`);
console.log(chalk`{bgGreen Passed:} ${totalResults.passed.length}`);
console.log(chalk`{bgRed Failed:} ${totalResults.failed.length}`);
console.log(chalk`{bgBlack Errors:} ${totalResults.errors.length}`);
console.log(chalk`{bgWhite Time Taken:} ${new Date(new Date().getTime() - startTime).toISOString().substr(14, 5)}s`);
console.log(chalk`{bgWhite Time Taken:} ${timeTaken}s`);
console.log('--------------------------------');

await this.cleanup();
Expand Down
2 changes: 1 addition & 1 deletion tasks/smoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = (program) => {
// eslint-disable-next-line no-console
console.error(err);
}
process.exit(2);
process.exit(1);
});
});
};
2 changes: 1 addition & 1 deletion test/tasks/smoke.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('Smoke Tests of the Smoke', () => {
test('should exit with a bad code if the test fails', (done) => {
const proc = spawn('./bin/n-test.js', ['smoke', '--host', 'http://localhost:3004', '--config', 'test/fixtures/smoke-fail.js']);
proc.on('close', (code) => {
expect(code).toEqual(2);
expect(code).toEqual(1);
done();
});
});
Expand Down

0 comments on commit 1e559a1

Please sign in to comment.