I would like to describe specifications that should be in the code, but implementation of them would be added later. In test results I would like to see them neither passed nor failed, but "are waiting" for implementation instead.
I'm interested if it is possible to do out of the box in mocha or jasmine.
Thanks
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.
A pending test in many test framework is test that the runner decided to not run. Sometime it's because the test is flagged to be skipped. Sometime because the test is a just a placeholder for a TODO. For Mocha, the documentation says that a pending test is a test without any callback.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With