Skip to content

programmatically call AVA tests #830

Closed
@ORESoftware

Description

@ORESoftware

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions