From 67a67ae780b89075c7bc8456f9da4f80459ebcce Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 5 Jun 2019 09:47:59 +0200 Subject: [PATCH] Validate against invalid suite injection --- tests/utils/misc/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/utils/misc/index.js b/tests/utils/misc/index.js index d4f63eb4d..9f944d997 100644 --- a/tests/utils/misc/index.js +++ b/tests/utils/misc/index.js @@ -106,6 +106,9 @@ function persistentRequest(...args) { const skippedWithNotice = []; function skipWithNotice(context, reason, afterCallback) { + if (!context || typeof context.skip !== 'function') { + throw new TypeError('Passed context is not a valid mocha suite'); + } if (process.env.CI) return; // Do not tolerate skips in CI environment skippedWithNotice.push({ context, reason }); process.stdout.write(chalk.yellow(`\n Skipped due to: ${chalk.red(reason)}\n\n`));