简体   繁体   中英

How do I run mocha test on array of data asynchronously?

How do I run same mocha tests to an array of data asynchronously(in parallel)?

This is the code I currently have:

const testData = [{'array': 'of data here'}];
describe('run these test to data', () => {
  testData.forEach((data) => {
    describe('mocha test', () => {
      it('asserts data', () => doStuff())
    })
  })
})

I tried using async package each but the time the tests runs is the same as before.

The goal is to lessen the amount of time the test runs.

If you use it, your problem can be solved.

expect details: https://www.chaijs.com/api/bdd/

 describe('...',() =>{ it('data tesing',(done) =>{ expect(data).to.be.an('array') } ) })

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