hbenl / vscode-mocha-test-adapter

Mocha Test Adapter for the VS Code Test Explorer
MIT License
91 stars 31 forks source link

unable find any suites when use delayed root suit #110

Closed silenceu closed 4 years ago

silenceu commented 4 years ago

Hello, thank for your great extension!

I find this extension couldn't find test suits when use delayed-root-suite. Does this extension implement this function, or I my .mocharc.js file is wrong?

Here is my envirment:

.mocharc.js:

module.exports = {
    delay: true,
    exit: true,
    file: ['server/app.js'],
    spec: [
        'test/top.test.js',
    ],
    timeout: 5000,
    env: {
        MOCHA_TEST: 'YES',
    }
}

test/top.test.js:

function importTest(name, path) {
    describe(name, () => {
        require(path);
    });
}

setTimeout(() => {
    describe('init', function () {
        before(function () {
           console.log('**************************************BEGIN**************************************');
        });
        importTest('account tests lodaing...', './account.test.js');
        after(function () {
            console.log('**************************************END**************************************');
        });
    });
    run();
}, 2000);
hbenl commented 4 years ago

Delayed root suites aren't supported yet, but I'll look into it.

silenceu commented 4 years ago

Ok, thank you for your contribution, I look forward to this feature! 🌷

hbenl commented 4 years ago

I have added --delay support to version 2.5.0. As usual, you can put it either in your Mocha configuration file or in your VS Code settings.