1

I am using Mocha and Karma for writing and running test cases for my emberjs client. I bundle all my test cases as a single file and using minispade.js to solve the dependency issues

The problem which I am facing is that, I am able to run the test cases, but if a test case fails, it only shows the description of the test case and does not provide any info about the file which has the case written.

Is there any way to show the file name also, if any test case fails?

4

1 回答 1

0

@stevekane,

您是否使用 minispade.require() 在测试用例模块中调用客户的代码(即 minispade 包装文件)?

以下是我使用 minispade 与 karma 的方式:

  1. 我会将我所有客户的代码和测试用例分别捆绑到一个文件中。示例:client.js 和 test_cases.js。
  2. 我将有一个单独的文件(比如 test.js),我将在其中声明一些用于运行我的测试用例的全局文件。在这个文件中,我还将使用 minispade.require() 调用我的客户的代码和测试用例。这是我的 test.js 文件的外观:

       mocha.setup({ ui: 'bdd', ignoreLeaks: true });
       var assert = chai.assert; ........
       window.minispade.require('app/main'); // Client's code
       window.minispade.require("spec/main"); // Test cases
    

    这里的 main.js 指的是一个文件,其中我使用 minspade.require() 包含了我的所有客户端和测试用例模块。

  3. 在业力配置文件中,我将在文件下包含测试用例代码。我的配置文件将包含以下几行:

    files = [
             {pattern : 'test_cases.js', included: true},
             {pattern : test.js', included: true}
          ].

4 运行业力运行命令。

希望我已经说清楚了。请尝试一下,如果您遇到困难,请告诉我。

于 2013-05-27T08:35:25.247 回答