Closed
Description
In the case that a developer wants to pass data to a test file programmatically (not at the command line)
with Mocha, seemingly the only way to do this would be:
function wrapTheMochaSuiteWithThisFn(data){
describe('root suite', function(){
describe('child suite', function(){
data.forEach( item => {
it('stubbed test case');
});
});
});
}
if(require.main === module){
wrapTheMochaSuiteWithThisFn([]); // if test file is executing directly, run it
}
module.exports = wrapTheMochaSuiteWithThisFn;
will we have to do the same thing with AVA if we want to pass data / inject data into tests?
Metadata
Metadata
Assignees
Labels
No labels