I have NodeJS and Mocha installed and working on Windows 7 x64 - so far, so good - but I can't get Mocha to recognise any tests defined using the exports
interface (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 'exports' interface example 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 tests complete (1ms)
D:\Projects\NodeDemo>
I suspect I've either missed a switch or something for specifying which interface mocha
should be using for test definitions, or I've found something that isn't supported on Windows (yet). Any ideas?
Of course, the second you post it to StackOverflow you notice a line of documentation that I'd swear wasn't there before... :)
mocha(1)
Usage: mocha [options] [files]
Options:
-u, --ui <name> specify user-interface (bdd|tdd|exports)
and sure enough, running
D:\Projects\NodeDemo>mocha -ui exports -R spec
does exactly what I expected. D'OH.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With