From 57e46042ee7aeef41f944a71e75f73dd3367254f Mon Sep 17 00:00:00 2001 From: "Aral Balkan (LabTop)" Date: Sun, 16 Jan 2022 20:55:00 +0000 Subject: [PATCH 1/2] fix: disregard whitespace in cli help text test --- tests/sirv-cli.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/sirv-cli.js b/tests/sirv-cli.js index d731218..73d0936 100644 --- a/tests/sirv-cli.js +++ b/tests/sirv-cli.js @@ -8,9 +8,10 @@ const help = suite('help'); help('--help', () => { let pid = utils.exec('--help'); assert.is(pid.status, 0); + assert.snapshot( - // prints extra NL; dedent doesnt cooperate - pid.stdout.toString().trimRight() + '\n ', + // compare output contents, excluding whitespace + pid.stdout.toString().replace(/\s/g, ''), ` Description Run a static file server @@ -46,7 +47,7 @@ help('--help', () => { $ sirv public -qeim 31536000 $ sirv --port 8888 --etag $ sirv --host --dev - ` + `.replace(/\s/g, '') ); }); From 4a9628d8f6ff4732ce41b5a6482570911a98482e Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Mon, 17 Jan 2022 12:22:14 -0800 Subject: [PATCH 2/2] Apply suggestions from code review --- tests/sirv-cli.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/sirv-cli.js b/tests/sirv-cli.js index 73d0936..570d55a 100644 --- a/tests/sirv-cli.js +++ b/tests/sirv-cli.js @@ -8,10 +8,9 @@ const help = suite('help'); help('--help', () => { let pid = utils.exec('--help'); assert.is(pid.status, 0); - assert.snapshot( - // compare output contents, excluding whitespace - pid.stdout.toString().replace(/\s/g, ''), + // compare output contents, normalize + pid.stdout.toString().trimRight(), ` Description Run a static file server @@ -47,7 +46,7 @@ help('--help', () => { $ sirv public -qeim 31536000 $ sirv --port 8888 --etag $ sirv --host --dev - `.replace(/\s/g, '') + `.trimRight() ); });