Skip to content

Commit

Permalink
Merge pull request #262 from hangtwenty/master
Browse files Browse the repository at this point in the history
Add instructive error message to importSuites that could help new users.
  • Loading branch information
indexzero committed Nov 19, 2014
2 parents 5dced8e + e9fb10d commit 068e027
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion bin/vows
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,20 @@ function importSuites(files) {
//f = path.join(process.cwd(), path.relative(process.cwd(),f));
var obj = require(f);
return suites.concat(Object.keys(obj).map(function (s) {
obj[s]._filename = cwdname(f);
try {
obj[s]._filename = cwdname(f);
} catch (e) {
if (e instanceof TypeError && typeof(obj[s]) === 'undefined') {
abort("runner",
"Caught a TypeError while trying to import " +
"suites: a suite is undefined." +
"Check your exports; are you doing something like " +
"exports.suite = vows.describe('foo')." +
"addBatch({}).run()? If so, remove '.run()'");
} else {
throw e;
}
}
return obj[s];
}));
}, [])
Expand Down

0 comments on commit 068e027

Please sign in to comment.