Skip to content
Browse files

Add instructive error message to `importSuites` that could help new u…

…sers.

Fixes issue #261.
  • Loading branch information...
1 parent a7843f4 commit e9fb10d2b98bfda89e68404af532e8d8ee58665a @hangtwenty committed Jan 21, 2013
Showing with 14 additions and 1 deletion.
  1. +14 −1 bin/vows
View
15 bin/vows
@@ -571,7 +571,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];
}));
}, [])

0 comments on commit e9fb10d

Please sign in to comment.
Something went wrong with that request. Please try again.