Following mocha nested test suite structure is run as expected with:
mocha --timeout 25000 test.js
describe('test suite 1', function() {
it('unit test 1', (done) => {
describe('test suite 2', function() {
it('unit test 2') {
describe('test suite 3', function() {
it('unit test 3') {
I don't see why this isn't the case when test are run with:
mocha --recursive --timeout 25000
Looking in debug log I can clearly see that it 2 and it 3 are not run. I have to use mocha --recursive --timeout 25000 as I have more test suite files.
The structure you are showing in your question is not supported by Mocha. To cover the various cases:
describe inside describe? Fine.
it inside describe? Fine.
describe inside it? Mocha does not support this. The results are undefined. If you get the results you expect, that's due to luck.
it inside it? Again, not supported by Mocha. The results are undefined.
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