* Returns an object with wrappers for the standard mocha/jasmine test * functions: `describe` and `it`, which will redirect to `xdescribe` and `xit`, * respectively, if provided predicate function returns false. * * Sample usage: * * const {Browser} = require('selenium-webdriver'); *
(predicateFn)
| 495 | * versions of the `describe` and `it` test functions. |
| 496 | */ |
| 497 | function ignore(predicateFn) { |
| 498 | const isJasmine = global.jasmine && typeof global.jasmine === 'object' |
| 499 | |
| 500 | const hooks = { |
| 501 | describe: getTestHook('describe'), |
| 502 | xdescribe: getTestHook('xdescribe'), |
| 503 | it: getTestHook('it'), |
| 504 | xit: getTestHook('xit'), |
| 505 | } |
| 506 | hooks.fdescribe = isJasmine ? getTestHook('fdescribe') : hooks.describe.only |
| 507 | hooks.fit = isJasmine ? getTestHook('fit') : hooks.it.only |
| 508 | |
| 509 | let describe = wrap(hooks.xdescribe, hooks.describe) |
| 510 | let fdescribe = wrap(hooks.xdescribe, hooks.fdescribe) |
| 511 | //eslint-disable-next-line no-only-tests/no-only-tests |
| 512 | describe.only = fdescribe |
| 513 | |
| 514 | let it = wrap(hooks.xit, hooks.it) |
| 515 | let fit = wrap(hooks.xit, hooks.fit) |
| 516 | //eslint-disable-next-line no-only-tests/no-only-tests |
| 517 | it.only = fit |
| 518 | |
| 519 | return { describe, it } |
| 520 | |
| 521 | function wrap(onSkip, onRun) { |
| 522 | return function (...args) { |
| 523 | if (predicateFn()) { |
| 524 | onSkip(...args) |
| 525 | } else { |
| 526 | onRun(...args) |
| 527 | } |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | /** |
| 533 | * @param {string} name |
no test coverage detected