diff --git a/js/src/utils/mocha.js b/js/src/utils/mocha.js index c21ae8739..d9fe0fb68 100644 --- a/js/src/utils/mocha.js +++ b/js/src/utils/mocha.js @@ -59,14 +59,21 @@ function getIt (config) { } if (Array.isArray(config.only)) { - if (config.only.includes(name)) return it.only(name, impl) // eslint-disable-line + const only = config.only + .map((o) => isObject(o) ? o : { name: o }) + .find((o) => o.name === name) + + if (only) { + if (only.reason) name = `${name} (${only.reason})` + return it.only(name, impl) // eslint-disable-line no-only-tests/no-only-tests + } } it(name, impl) } _it.skip = it.skip - _it.only = it.only // eslint-disable-line + _it.only = it.only // eslint-disable-line no-only-tests/no-only-tests return _it }