Skip to main content
Version: 5.9 🚧

Conditional tests with X Methods

An idea that is popular with Javascript testing frameworks is to allow the test keywords to be prefixed with 'x' to disable the test, and any nested tests.

This is similar to using the bang character in the test name.

For example, with DescribeSpec we can replace describe with xdescribe as in this example:

class XMethodsExample : DescribeSpec({

xdescribe("this block and it's children are now disabled") {
it("will not run") {
// disabled test
}
}

})

Similarly, we could add the prefix to a nested test:

class XMethodsExample : DescribeSpec({

describe("this block is enabled") {
xit("will not run") {
// disabled test
}
it("will run") {
// enabled test
}
}

})

See which specs support this, and the syntax required on the specs styles guide.