How to set execution order of mocha test cases in multiple files

后端 未结 7 678
感情败类
感情败类 2020-12-13 08:42

I have two javascript files which contain mocha test cases.

//----------abc.js -------------

describe(\"abc file\", function(){
  it(\"test 1\" , function(         


        
7条回答
  •  执笔经年
    2020-12-13 08:54

    I am exporting an array with all required files and that is the way I tell mocha the order of execution through index.js file in the folder with all my test files:

    const Login = require('../login');
    const ChangeBudgetUnit = require('./changeBudgetUnit');
    const AddItemsInCart = require('./addItemsInCart'); 
    
    // if the order matters should export array, not object
    module.exports = [
        Login,
        ChangeBudgetUnit,
        AddItemsInCart
    ];
    

提交回复
热议问题