2014-08-29 33 views
0

随着实习生版本1.7,我能够在Windows(Git Bash)和CentOS上(在VirtualBox VM中)运行node node_modules/intern/bin/intern-client.js config=test/internNode。如果至少有一项测试失败,则不会生成覆盖率报告。实习生2.0:覆盖率报告不再在Windows上生成(回归)

随着实习生版本2.0,绝不会在Windows上生成覆盖率报告,只能在CentOS上生成。如果测试失败,它们现在甚至会生成...

似乎没有任何Intern依赖关系是平台相关的。是否有可能因为为Linux准备的路径而出现故障?

A +,DOM的


更新与所述配置文件:

  • 模块FileScanner检索匹配在指定文件夹中的给定的正则表达式中的所有文件。它避免了必须记录要运行的测试文件的静态列表。
  • 测试套件运行代码来验证客户端逻辑和服务器逻辑。

/*global define*/ 
define([ 
    'intern/node_modules/dojo/has', 
    'src/tests/FileScanner' 
], function (has, FileScanner) { 
    'use strict'; 

    has.add('tests-api', true); // To enable entry points for test purposes 
    has.add('dojo-debug-messages', false); // 

    var unitTestFiles = new FileScanner.getFiles(['src/client/ubi', 'src/server'], /(?:\w+\/)*\w+Test\.js$/), 
     functionTestFiles = []; 

    return { 
     useLoader: { 
      'host-node': 'dojo/dojo' 
     }, 

     loader: { 
      map: { 
       '*': { 
        'dojo/has': 'intern/node_modules/dojo/has', 
        'dojo/node': 'intern/node_modules/dojo/node', 
        'dojo/text': 'ubi/utils/tests/dojo/textMock', 
        'dojo/parser': 'ubi/utils/tests/dojo/parserMock', 
        'dijit/_TemplatedMixin': 'ubi/utils/tests/dijit/_TemplatedMixinMock', 
        'dijit/_WidgetBase': 'ubi/utils/tests/dijit/_WidgetBaseMock', 
        'dijit/_WidgetsInTemplateMixin': 'ubi/utils/tests/dijit/_WidgetsInTemplateMixinMock', 
        'dijit/_AttachMixin': 'ubi/utils/tests/dijit/_AttachMixinMock', 

        // To limit side-effects of the GFX library 
        'dojox/charting/Chart': 'ubi/utils/tests/noopMock', 
        'dojox/charting/widget/Chart': 'ubi/utils/tests/noopMock', 
        'dojox/charting/axis2d/Default': 'ubi/utils/tests/noopMock', 
        'dojox/charting/plot2d/Lines': 'ubi/utils/tests/noopMock', 
        'dojox/charting/plot2d/Markers': 'ubi/utils/tests/noopMock', 
        'dojox/charting/plot2d/Pie': 'ubi/utils/tests/noopMock', 
        'dojox/charting/action2d/Highlight': 'ubi/utils/tests/noopMock', 
        'dojox/charting/action2d/Magnify': 'ubi/utils/tests/noopMock', 
        'dojox/charting/action2d/MoveSlice': 'ubi/utils/tests/noopMock', 
        'dojox/charting/action2d/PlotAction': 'ubi/utils/tests/noopMock', 
        'ubi/charting/themes/omega': 'ubi/utils/tests/noopMock' 
       } 
      }, 
      packages: [{ 
       name: 'dojo', 
       location: 'src/libs/dojo' 
      }, { 
       name: 'dijit', 
       location: 'src/libs/dijit' 
      }, { 
       name: 'dojox', 
       location: 'src/libs/dojox' 
      }, { 
       name: 'ubi', 
       location: 'src/client/ubi' 
      }, { 
       name: 'server', 
       location: 'src/server' 
      }, { 
       name: 'tests', 
       location: 'src/tests' 
      }] 
     }, 

     suites: unitTestFiles, 

     functionalSuites: functionTestFiles, 

     excludeInstrumentation: /(?:node_modules|libs|tests)/ 
    }; 
}); 

更新与Gruntfile插件配置:

  • unitTest变量被取出以作为参数向咕噜命令
  • 我使用它来运行一的值测试套件

intern: { 
    'unit-tests': { 
     options: { 
      runType: 'client', 
      config: 'src/tests/internNode', 
      reporters: ['console', 'lcovhtml'], 
      reportDir: 'target/code-coverage', 
      suites: unitTest === null ? [] : [unitTest] 
     } 
    } 
} 
+0

请注意,从Intern配置中除去'excludeInstrumentation'属性将生成报告。 我发现这个技巧在https://stackoverflow.com/questions/23290853/how-to-include-modules-for-code-coverage-when-using-intern-for-nodejs-unit-testi – 2014-08-29 19:20:16

+0

你将需要至少提供您的配置,以便任何人都能够回答您的问题。 – 2014-08-30 20:34:16

+0

因为在升级过程中我没有更改配置文件,所以我认为它没有关系......但是,我将使用该信息更新问题。 – 2014-09-02 11:12:34

回答

1

实习生存在导致此问题的缺陷。解决该问题的补丁是https://github.com/theintern/intern/pull/255,并将为Intern 2.1(也许是另一个2.0版本发布)着陆。

+0

感谢您的更新科林。 我希望对[实习生问题#71](https://github.com/theintern/intern/issues/71#issuecomment-44213335)的修复也将使它成为2.1。 – 2014-09-03 02:13:25

+0

仅供参考,我刚刚更新了我的本地'runner.js'副本以更新以规范basePath,并且它不能解决问题,因为我的测试是由'client.js'运行的,而不是'runner.js'。看到我上面的Gruntfile配置;) – 2014-09-03 12:52:49

+1

是的,在lib/realClient.js中存在相同的行,所以它也不会在那里工作。 – 2014-09-05 01:21:31

相关问题