Declare "pending" specs/tests in jasmine or mocha
Starting with Jasmine 2.0, writing xit()
instead of it()
for a spec marks it as pending (as already said in a comment of the accepted answer).
Aditionally, there is a pending()
function you can call anywhere inside a spec to mark it as pending:
it("can be declared by calling 'pending' in the spec body", function() {
expect(true).toBe(false);
pending();
});
See also the documentation on pending specs in Jasmine 2.0.
You can declare disabled functions in both mocha and jasmine using xit
(instead of it
), and xdescribe
(instead of describe).
If you want the tests to appear as pending, in mocha you can just leave the second parameter blank in the call to the it()
function. For example:
describe('Something', function () {
it('Should be pending')
xit('Should be disabled, i.e not appear on the list')
});
Update: The behaviour for xit
/xdescribe
is might change in Mocha if this merge happens: https://github.com/visionmedia/mocha/pull/510
In mocha, you can also use skip
:
describe('my module', function() {
it.skip('works', function() {
// nothing yet
});
});
You can also do describe.skip
to skip whole sections.