Skip to content

Commit

Permalink
Remove DEBUG check to fallback to console.error
Browse files Browse the repository at this point in the history
  • Loading branch information
satazor authored and Americas committed Jan 2, 2025
1 parent 0dd3e29 commit 2d7f1c3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
7 changes: 0 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ class ProcessManager {
this.log.error(`Exiting with ${this.errors.length} error${this.errors.length > 1 ? 's' : ''}`);
this.errors.forEach(err => this.log.error(err));

// Output console to error in case no `DEBUG` namespace has been set.
// This mimicks the default node behaviour of not silencing errors.
if (!process.env.DEBUG) {
// eslint-disable-next-line no-console
console.error(...this.errors);
}

return process.exit(1);
}

Expand Down
20 changes: 0 additions & 20 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,26 +151,6 @@ describe('ProcessManager', () => {
expect(process.exit).toHaveBeenCalled();
expect(process.exit).toHaveBeenCalledWith(1);
});

test('calls `console.error` if `DEBUG` is not set', () => {
processManager.errors = [new Error()];

processManager.exit();

expect(console.error).toHaveBeenCalled();
expect(console.error).toHaveBeenCalledWith(...processManager.errors);
});

test('does not call `console.error` if `DEBUG` is set', () => {
process.env.DEBUG = 'foo';
processManager.errors = [new Error()];

processManager.exit();

expect(console.error).not.toHaveBeenCalled();

delete process.env.DEBUG;
});
});

describe('hook()', () => {
Expand Down

0 comments on commit 2d7f1c3

Please sign in to comment.