Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.

Commit

Permalink
feat(test): add test.failing and test.skip methods
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jul 16, 2018
1 parent 2c5ae7d commit e42621b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
9 changes: 7 additions & 2 deletions providers/VowProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ class VowProvider extends ServiceProvider {
* and `this` resolves to undefined.
*/
return _.transform(Object.getOwnPropertyNames(Object.getPrototypeOf(suite)), (result, prop) => {
result[prop] = function (...args) {
return suite[prop](...args)
if (prop === 'test') {
const testFn = (...args) => suite[prop](...args)
testFn.failing = (...args) => suite.failing(...args)
testFn.skip = (...args) => suite.skip(...args)
result[prop] = testFn
} else {
result[prop] = (...args) => suite[prop](...args)
}
}, {})
}
Expand Down
22 changes: 22 additions & 0 deletions test/integration/runner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,26 @@ jTest.group('Runner', (group) => {
await runner.run()
jAssert.deepEqual(called, ['beforeEach', 'afterEach', 'beforeEach', 'afterEach'])
})

jTest('define failing test', async (jAssert) => {
const { test } = use('Test/Suite')('My Sample suite')

const runner = use('Test/Runner')
test.failing('2 + 2 is 4', function ({ assert }) {
assert.equal(2 + 2, 5)
})

await runner.run()
})

jTest('define skip test', async (jAssert) => {
const { test } = use('Test/Suite')('My Sample suite')

const runner = use('Test/Runner')
test.skip('2 + 2 is 4', function ({ assert }) {
assert.equal(2 + 2, 5)
})

await runner.run()
})
})

0 comments on commit e42621b

Please sign in to comment.