From 55f597b1b8f45feed38e06da2f6f313611613248 Mon Sep 17 00:00:00 2001 From: Pshenkin Andrey Date: Fri, 1 Dec 2017 11:58:01 +0300 Subject: [PATCH] fix displaying undefined args in output --- lib/step.js | 2 ++ test/unit/steps_test.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib/step.js b/lib/step.js index 03623b199..4b11db0de 100644 --- a/lib/step.js +++ b/lib/step.js @@ -57,6 +57,8 @@ class Step { return arg.toString(); } else if (typeof arg === "object") { return JSON.stringify(arg); + } else if (typeof arg === "undefined") { + return `${arg}`; } else if (arg.toString) { return arg.toString(); } diff --git a/test/unit/steps_test.js b/test/unit/steps_test.js index 7d5df4160..1645c772b 100644 --- a/test/unit/steps_test.js +++ b/test/unit/steps_test.js @@ -29,6 +29,10 @@ describe('Step', () => { step.args = [{css: '.class'}]; step.humanizeArgs().should.eql('{"css":".class"}'); + + let testUndefined; + step.args = [testUndefined, 'undefined']; + step.humanizeArgs().should.eql('undefined, "undefined'); }); it('should provide nice output', () => {