What does 'pending' test mean in Mocha, and how can I make it pass/fail?
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...
});
when I facing with this issue, the pending error was when I define a describe test with skip, and forgot to remove it, like that:
describe.skip('padding test', function () {
it('good test', function () {
expect(true).to.equal(true);
})
});
and did run it, I got the output
Pending test 'good test'
and when I remove the skip flag on the describe test, it does work again..
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.
Are you sure you are looking at the good test ?