当测试存在于不同的文件中时,如何在茉莉花中对测试套件进行分组?

Siv*_*mar 6 javascript jasmine karma-jasmine

根据文档,我们可以有组 - 子组的测试套件,但它们只存在于下面的一个文件中

describe('Main Group - Module 1', function () {

    beforeEach(function () {
        module('app');
    });

    describe('sub group - 1', function () { // Sub group        
        // specs goes here
    });

     describe('sub group - 2', function () { // Sub group       
        // specs goes here
    });
});
Run Code Online (Sandbox Code Playgroud)

如果我想将子组-1子组-2保存在两个不同的文件中,如何在主组 - 模块中对这两个子组进行分组?

谢谢

Sub*_*ash 3

您可以执行以下操作:

文件1.js

describe('Main Group - Module 1', function () {

    beforeEach(function () {
        module('app');
    });

    describe('sub group - 1', function () { // Sub group        
        // specs goes here
    });

});
Run Code Online (Sandbox Code Playgroud)

文件2.js

describe('Main Group - Module 1', function () {

    beforeEach(function () {
        module('app');
    });

     describe('sub group - 2', function () { // Sub group       
        // specs goes here
    });
});
Run Code Online (Sandbox Code Playgroud)

请注意相同的父母姓名。