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...
});

Leave a Comment

tech