Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
fix: default to display stack trace
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 4, 2018
1 parent 67d28b2 commit 20d719c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class Config {
errorsHandled = false
context: any = {}
errlog?: string
showStackTrace = true

constructor() {
this.debug = process.env.DEBUG === '*'
Expand Down
2 changes: 1 addition & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function getErrorMessage(err: any, opts: {stack?: boolean} = {}): string
message,
].join('')

if (opts.stack || process.env.CI || severity === 'fatal' || config.debug) {
if (config.showStackTrace || opts.stack || process.env.CI || severity === 'fatal' || config.debug) {
// show stack trace
let stack = err.stack || inspect(err)
stack = clean(stack, {pretty: true})
Expand Down
1 change: 1 addition & 0 deletions test/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('errors', () => {
.env({CI: null})
.stderr()
.it('warns', async output => {
cli.config.showStackTrace = false
cli.warn('foobar')
if (process.platform === 'win32') {
expect(output.stderr).to.equal(' ! Warning: foobar\n')
Expand Down

0 comments on commit 20d719c

Please sign in to comment.