I am running my tests and noticed:
18 passing (150ms) 1 pending
I haven't seen this before. Previously test either passed, or failed. Timeouts caused failures. I can see which test is failing because it's also blue. But it has a timeout on it. Here's a simplified version:
test(`Errors when bad thing happens`), function(){ try { var actual = doThing(option) } catch (err) { assert(err.message.includes('invalid')) } throw new Error(`Expected an error and didn't get one!`) }
Thanks!
For Mocha, the documentation says that a pending test is a test without any callback.
A test that has been selected to run but is not yet in progress.
This inclusive ability is available in Mocha by appending . skip() to the suite or to specific test cases. The skipped tests will be marked as "pending" in the test results.
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(); });
A test can end up being shown by Mocha as "pending" when you inadvertently closed the test's it
method early, like:
// Incorrect -- arguments of the it method are closed early it('tests some functionality'), () => { // Test code goes here... };
The it
method's arguments should include the test function definition, like:
// Correct it('tests some functionality', () => { // Test code goes here... });
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