简体   繁体   中英

Gulp-Mocha delay before performing test

The normal version of Mocha supports delays before executings tests (link: https://mochajs.org/#hooks ).

Is there a way to do this in gulp-mocha?

The tests syntax remains the same when using gulp-mocha in compare to simple mocha

Actually, gulp-mocha is just a wrapper to help you run test suites via gulp

The ideal way to fix this issue is to make an asynchronous test.

describe('StackOverflowExample', function() {
    it('Demonstrates how to create a test with delay', async function(done) {
        setTimeout(() => {
            //Your code here
            done();
        }, 250); //Set the delay to your liking
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM