Skip to content

Commit

Permalink
Failure should result in non-zero exit code (#174)
Browse files Browse the repository at this point in the history
- Set error code to 1 on failure
  • Loading branch information
nikolay-borzov committed Mar 28, 2020
1 parent d9c5749 commit f352bfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,5 +287,7 @@ if (require.main === module) {
} else {
logError('Failed to explore', error);
}

process.exitCode = 1;
});
}
8 changes: 2 additions & 6 deletions tests/e2e/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ describe('CLI', () => {
it('should output result as tsv', async () => {
const result = await execute(SCRIPT_PATH, ['data/inline-map.js', '--tsv']);

expect(result)
.to.have.string('Source\tSize')
.and.have.string('src/bar.js\t104');
expect(result).to.have.string('Source\tSize').and.have.string('src/bar.js\t104');
});

it('should output result as tsv excluding source map bytes', async () => {
Expand All @@ -59,9 +57,7 @@ describe('CLI', () => {
it('should output result as tsv excluding unmapped bytes', async () => {
const result = await execute(SCRIPT_PATH, ['data/with-unmapped.js', '--tsv', '--only-mapped']);

expect(result)
.to.have.string('Source\tSize')
.and.not.have.string('[unmapped]\t');
expect(result).to.have.string('Source\tSize').and.not.have.string('[unmapped]\t');
});

it('should output multiple results as tsv', async () => {
Expand Down

0 comments on commit f352bfa

Please sign in to comment.