With Intern revision 1.7, I was able to run node node_modules/intern/bin/intern-client.js config=test/internNode
on Windows (Git Bash) and on CentOS (within a VirtualBox VM). If at least one test was failing, the coverage report was not generated.
With Intern revision 2.0, coverage reports are never generated on Windows, only on CentOS. They are now even generated if a test fails...
It does not seem that any of the Intern dependency is platform dependent. Is it possible one has a glitch due to a path just formated for Linux?
A+, Dom
Update with the configuration file:
- The module
FileScanner
retrieves all files matching the given regular expression in the specified folders. It avoids having to document a static list of test files to run. - The test suite runs code to verify both the client logic and the server logic.
.
/*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)/
};
});
Update with the Gruntfile plugin configuration:
- The
unitTest
variable is fetched with a value given as a parameter to the grunt command - I use it to run one test suite at a time
.
intern: {
'unit-tests': {
options: {
runType: 'client',
config: 'src/tests/internNode',
reporters: ['console', 'lcovhtml'],
reportDir: 'target/code-coverage',
suites: unitTest === null ? [] : [unitTest]
}
}
}