From 400f685785f8415e9426527ddc141e73fa689563 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Wed, 5 Jun 2024 07:41:31 -0500 Subject: [PATCH] test: ignore line ending differences across os --- test/commands/alias/set.nut.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/commands/alias/set.nut.ts b/test/commands/alias/set.nut.ts index 6f76c003..86ca0122 100644 --- a/test/commands/alias/set.nut.ts +++ b/test/commands/alias/set.nut.ts @@ -73,9 +73,9 @@ describe('alias set NUTs', () => { }).jsonOutput; expect(result?.result).to.deep.equal([{ alias: 'foo with space', success: true, value }]); - expect(result?.warnings).to.deep.equal([ - messages.getMessage('warning.spaceAlias', ['foo with space', 'foo with space']), - ]); + expect(result?.warnings?.map(stripLineEndings)).to.deep.equal( + [messages.getMessage('warning.spaceAlias', ['foo with space', 'foo with space'])].map(stripLineEndings) + ); }); it('allow setting a single alias without an equal sign', () => { @@ -182,3 +182,5 @@ describe('alias set NUTs', () => { }); }); }); + +const stripLineEndings = (str?: string): string => str?.replace(/\r?\n|\r/g, '') ?? '';