随着实习生版本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]
}
}
}
请注意,从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
你将需要至少提供您的配置,以便任何人都能够回答您的问题。 – 2014-08-30 20:34:16
因为在升级过程中我没有更改配置文件,所以我认为它没有关系......但是,我将使用该信息更新问题。 – 2014-09-02 11:12:34