From 04f700820e91a5b2edad8dd23ac3ee1d89ab2973 Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Tue, 20 Feb 2024 13:56:27 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Josh Goldberg ✨ --- lib/reporters/base.js | 2 +- lib/runner.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/reporters/base.js b/lib/reporters/base.js index 5af6e7bd8a..6dd18a64ee 100644 --- a/lib/reporters/base.js +++ b/lib/reporters/base.js @@ -230,7 +230,7 @@ var generateDiff = (exports.generateDiff = function (actual, expected) { * @return {{ message: string, msg: string, stack: string }} */ var getFullErrorStack = function (err, seen) { - if (seen && seen.has(err)) { + if (seen?.has(err)) { return { message: '', msg: '', stack: '' }; } diff --git a/lib/runner.js b/lib/runner.js index 60a19f0e3f..87b4b8c3a4 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -448,7 +448,7 @@ Runner.prototype.fail = function (test, err, force) { const alreadyFiltered = new Set(); let currentErr = err; - while (currentErr && currentErr.stack && !alreadyFiltered.has(currentErr)) { + while (currentErr?.stack && !alreadyFiltered.has(currentErr)) { alreadyFiltered.add(currentErr); try {