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

后端 未结 7 695
感情败类
感情败类 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 09:11

    The way it worked for my tests to be executed in a specific order was to create a separate test.js file and then added a describe for each mocha test file I'd wanted to execute.

    test.js:

    describe('test file 1', function() {
      require('./test1.js')
    })
    
    describe('test file 2', function() {
      require('./test2.js')
    })
    

    Then simply run mocha test.js

提交回复
热议问题