Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

fix: allow only by object #407

Merged
merged 2 commits into from
Dec 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions js/src/utils/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down