Created
November 24, 2011 03:21
-
-
Save bingomanatee/1390560 to your computer and use it in GitHub Desktop.
mocha test ... why?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('basic', function () { | |
var app; | |
var content = 'hello world'; | |
before(function (done) { | |
console.log('requiring server'); | |
//app = require('./strata_server/app'); | |
// console.log('server: ', util.inspect(app)); | |
done(); | |
}); | |
describe('#body', function (done) { | |
console.log('mock request'); | |
/* mock.request({requestMethod:"GET"}, app, | |
function (err, status, headers, body) { | |
console.log('err', util.inspect(err)); | |
console.log('status', util.inspect(status)); | |
console.log('headers', util.inspect(headers)); | |
console.log('body', body); | |
if (body != content) throw new Error('body (' + body + ') is not content'); | |
done(); | |
}); */ | |
done(); | |
}); | |
}); |
hmm, appears fine to me:
describe('basic', function(){
var app;
before(function(done){
console.log('before');
done()
})
describe('#body', function(){
it('should do stuff', function(done){
console.log('test');
done()
})
})
})
$ mocha test
before
test
.
✔ 1 tests complete (3ms)
oh hahhaha i just noticed you have describe('', function(){
and your assertions in there
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
getting some odd behavior
Acropolis:nuby-strata dave$ mocha -s 100
mock request
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: undefined is not a function
at /Users/dave/Documents/AC_Strata/node_modules/nuby-strata/test/strata.js:26:9
at /opt/local/lib/node_modules/mocha/lib/interfaces/bdd.js:72:7
note that 'requiring server' in before (or beforeEach) doesn't fire off, and the passed callback (done) from line 11 is not recognized as a function.