Skip to content

Commit

Permalink
test: handle line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 30, 2023
1 parent dd7bb5f commit a01e14c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function error(input: Error | string, options: {exit?: false | number} &

if (options.exit === false) {
const message = prettyPrint(err)
if (message) write.stderr(message)
if (message) write.stderr(message + '\n')
if (config.errorLogger) config.errorLogger.log(err?.stack ?? '')
} else throw err
}
Expand All @@ -52,7 +52,7 @@ export function warn(input: Error | string): void {
}

const message = prettyPrint(err)
if (message) write.stderr(message)
if (message) write.stderr(message + '\n')
if (config.errorLogger) config.errorLogger.log(err?.stack ?? '')
}

Expand Down
2 changes: 1 addition & 1 deletion test/config/ts-node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ describe('tsPath', () => {
const stderrStub = sandbox.stub(write, 'stderr')
const result = await configTsNode.tsPath(root, tsSource)
expect(result).to.equal(join(root, tsSource))
expect(stripAnsi(stderrStub.firstCall.firstArg).split('\n').at(-1)).to.include('Falling back to compiled source')
expect(stripAnsi(stderrStub.firstCall.firstArg).split('\n').join(' ')).to.include('Falling back to compiled source')
})
})

0 comments on commit a01e14c

Please sign in to comment.