How do I get mocha to run "export" tests on Windows?
I have NodeJS and Mocha installed and working on Windows 7 x64 - so good so far, but I can't get Mocha to recognize any tests defined with the frontend exports
(as described at http://visionmedia.github.com/mocha/ )
If I create test / bdd.js containing the following code:
var should = require('should');
describe('TestDemo - BDD interface', function(){
describe('#foo', function(){
it('1 should equal 1', function(){ (1).should.equal(1); });
});
});
I can run mocha and get the expected output:
D:\Projects\NodeDemo>mocha -R spec
TestDemo - BDD interface
#foo
β 1 should equal 1
β 1 tests complete (7ms)
D:\Projects\NodeDemo>
BUT if I create test / exports.js containing this code (based on the example export frontend provided on the Mocha site)
var should = require('should');
module.exports = {
'TestDemo - exports interface': {
'#foo': {
'1 should equal 1': function(){ (1).should.equal(1); }
}
}
};
when i run Mocha it doesn't find any tests:
D: \ Projects \ NodeDemo> mocha -R spec
β 0 completed tests (1ms)
D: \ Projects \ NodeDemo>
I suspect I either missed the switch or something to indicate which interface mocha
should be used for test definitions, or I found something that is not supported on Windows (yet). Any ideas?
source to share
Of course, the second you post it to StackOverflow, you notice the docstring which I swear was not there before ... :)
mocha(1)
Usage: mocha [options] [files]
Options:
-u, --ui <name> specify user-interface (bdd|tdd|exports)
and confident enough by running
D:\Projects\NodeDemo>mocha -ui exports -R spec
does exactly what I expected. D'ON.
source to share