Validate against invalid suite injection

This commit is contained in:
Mariusz Nowak 2019-06-05 09:47:59 +02:00
parent a68150356c
commit 67a67ae780
No known key found for this signature in database
GPG Key ID: B1FBDA8A182B03F2

View File

@ -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`));