* 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)
| 548 | * versions of the `describe` and `it` test functions. |
| 549 | */ |
| 550 | function ignore(predicateFn) { |
| 551 | const isJasmine = global.jasmine && typeof global.jasmine === 'object' |
| 552 | |
| 553 | const hooks = { |
| 554 | describe: getTestHook('describe'), |
| 555 | xdescribe: getTestHook('xdescribe'), |
| 556 | it: getTestHook('it'), |
| 557 | xit: getTestHook('xit'), |
| 558 | } |
| 559 | hooks.fdescribe = isJasmine ? getTestHook('fdescribe') : hooks.describe.only |
| 560 | hooks.fit = isJasmine ? getTestHook('fit') : hooks.it.only |
| 561 | |
| 562 | let describe = wrap(hooks.xdescribe, hooks.describe) |
| 563 | let fdescribe = wrap(hooks.xdescribe, hooks.fdescribe) |
| 564 | //eslint-disable-next-line no-only-tests/no-only-tests |
| 565 | describe.only = fdescribe |
| 566 | |
| 567 | let it = wrap(hooks.xit, hooks.it) |
| 568 | let fit = wrap(hooks.xit, hooks.fit) |
| 569 | //eslint-disable-next-line no-only-tests/no-only-tests |
| 570 | it.only = fit |
| 571 | |
| 572 | return { describe, it } |
| 573 | |
| 574 | function wrap(onSkip, onRun) { |
| 575 | return function (...args) { |
| 576 | if (predicateFn()) { |
| 577 | onSkip(...args) |
| 578 | } else { |
| 579 | onRun(...args) |
| 580 | } |
| 581 | } |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | /** |
| 586 | * @param {string} name |
no test coverage detected