Created
February 6, 2015 03:46
-
-
Save akiellor/12db63d9b578447b9aed to your computer and use it in GitHub Desktop.
Mocha/Promise error detection.
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
var falafel = require('falafel'); | |
var fs = require('fs'); | |
var file = process.argv[2]; | |
var src = fs.readFileSync(file).toString(); | |
var output = falafel(src, {loc: true}, function (node) { | |
if (node.type === 'Identifier' && node.name === "it") { | |
var testBody = node.parent.arguments[1].body.body | |
var lastStatement = testBody[testBody.length - 1]; | |
if(lastStatement.type !== 'ReturnStatement') { | |
console.log(file + ":" + lastStatement.loc.start.line); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment