From a01e14cc14c7dddacb45b298a4defc8286142fe7 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Mon, 30 Oct 2023 11:26:51 -0600 Subject: [PATCH] test: handle line breaks --- src/errors/index.ts | 4 ++-- test/config/ts-node.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/errors/index.ts b/src/errors/index.ts index edb57969c..70643db14 100644 --- a/src/errors/index.ts +++ b/src/errors/index.ts @@ -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 } @@ -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 ?? '') } diff --git a/test/config/ts-node.test.ts b/test/config/ts-node.test.ts index 85a5e0bd5..801620a0b 100644 --- a/test/config/ts-node.test.ts +++ b/test/config/ts-node.test.ts @@ -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') }) })