From a85b214a7fcc11c4e53f64e2f857dbc9755eae75 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 29 Apr 2022 15:04:05 +0200 Subject: [PATCH] Test: Add coverage for cyclical array case of TapReporter --- test/cli/TapReporter.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/cli/TapReporter.js b/test/cli/TapReporter.js index 2190f679e..f91e552e5 100644 --- a/test/cli/TapReporter.js +++ b/test/cli/TapReporter.js @@ -351,6 +351,29 @@ Bail out! ReferenceError: Boo is not defined ); }); + QUnit.test('output actual value with a cyclical array', assert => { + function createCyclicalArray () { + const cyclical = { sub: ['example'] }; + cyclical.sub.push(cyclical.sub); + cyclical.sub.push(cyclical); + return cyclical; + } + emitter.emit('testEnd', makeFailingTestEnd(createCyclicalArray())); + assert.strictEqual(last, ` --- + message: failed + severity: failed + actual : { + "sub": [ + "example", + "[Circular]", + "[Circular]" + ] +} + expected: expected + ...` + ); + }); + QUnit.test('output actual assertion value of an acyclical structure', assert => { // Creates an object that references another object more // than once in an acyclical way.