Skip to content

Commit

Permalink
Test: Add coverage for cyclical array case of TapReporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed Apr 29, 2022
1 parent 32223a0 commit a85b214
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/cli/TapReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a85b214

Please sign in to comment.