Skip to content

Commit

Permalink
Add instructive error message to importSuites that could help new u…
Browse files Browse the repository at this point in the history
…sers.

Fixes issue #261.
  • Loading branch information
floer32 committed Jan 21, 2013
1 parent a7843f4 commit e9fb10d
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 @@ -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];
}));
}, [])
Expand Down

0 comments on commit e9fb10d

Please sign in to comment.