Skip to content

Commit

Permalink
Skip Suite on Filter for Jest only
Browse files Browse the repository at this point in the history
  • Loading branch information
tremlfl committed May 19, 2019
1 parent 16b388d commit 12a00cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 1 addition & 8 deletions src/BotiumBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ module.exports = class BotiumBindings {
this.compiler.scriptingEvents.fail = failCb
}

let testCount = 0
this.compiler.convos.forEach((convo) => {
debug(`adding test case ${convo.header.toString()}`)
const included = testcaseCb(convo, (testcaseDone) => {
testcaseCb(convo, (testcaseDone) => {
if (this.container) {
debug(`running testcase${convo.header.toString()}`)

Expand All @@ -116,13 +115,7 @@ module.exports = class BotiumBindings {
testcaseDone(new Error('Botium Initialization failed. Please see error messages above (enable debug logging).'))
}
})
if (included) {
testCount++
}
})
if (testCount == 0) {
it.skip('skip empty test suite', () => {})
}
}

UserSaysText (...args) {
Expand Down
7 changes: 6 additions & 1 deletion src/helpers/jest.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
/* global describe test beforeAll beforeEach afterAll afterEach */
/* global describe test it beforeAll beforeEach afterAll afterEach */

const BotiumBindings = require('../BotiumBindings')

const setupJestTestCases = ({ testcaseSelector, bb } = {}) => {
bb = bb || new BotiumBindings()

let testCount = 0
bb.setupTestSuite(
(testcase, testcaseFunction) => {
if (testcaseSelector && !testcaseSelector(testcase)) return false

testCount++
test(testcase.header.name, testcaseFunction)
return true
}
)
if (testCount === 0) {
it.skip('skip empty test suite', () => {})
}
}

const setupJestTestSuite = ({ name, testcaseSelector, bb } = {}) => {
Expand Down

0 comments on commit 12a00cf

Please sign in to comment.