Skip to content
This repository has been archived by the owner on May 28, 2021. It is now read-only.

Commit

Permalink
feat: Support "specify" test blocks (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbard1 committed Mar 22, 2021
1 parent f2843e8 commit 1094adb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cypress/integration/spec.js
Expand Up @@ -15,6 +15,6 @@ describe('Example tests', () => {
it('does B', () => {})

// @tags foo,bar
it('does C', () => {})
specify('does C', () => {})
})
})
9 changes: 7 additions & 2 deletions src/spec-parser.js
Expand Up @@ -16,6 +16,8 @@ const isContext = isTestBlock('context')

const isIt = isTestBlock('it')

const isSpecify = isTestBlock('specify')

const isItOnly = node => {
return (
node.type === 'CallExpression' &&
Expand Down Expand Up @@ -68,7 +70,7 @@ const findTests = source => {
const onNode = node => {
// console.log(node)

if (isIt(node)) {
if (isIt(node) || isSpecify(node)) {
const names = [getItsName(node)]
findSuites(node, names)

Expand Down Expand Up @@ -103,7 +105,7 @@ const skipTests = (source, leaveTests) => {
const onNode = node => {
// console.log(node)

if (isIt(node)) {
if (isIt(node) || isSpecify(node)) {
const names = [getItsName(node)]
findSuites(node, names)
// we were searching from inside out, thus need to revert the names
Expand All @@ -115,6 +117,9 @@ const skipTests = (source, leaveTests) => {
debug('leaving test', testName)
} else {
debug('disabling test', testName)
if (isSpecify(node)) {
return node.update('specify.skip' + node.source().substr(7))
}
node.update('it.skip' + node.source().substr(2))
}
}
Expand Down

0 comments on commit 1094adb

Please sign in to comment.