Skip to content

Commit e9fb10d

Browse files
committed
Add instructive error message to importSuites that could help new users.
Fixes issue #261.
1 parent a7843f4 commit e9fb10d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

bin/vows

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,20 @@ function importSuites(files) {
571571
//f = path.join(process.cwd(), path.relative(process.cwd(),f));
572572
var obj = require(f);
573573
return suites.concat(Object.keys(obj).map(function (s) {
574-
obj[s]._filename = cwdname(f);
574+
try {
575+
obj[s]._filename = cwdname(f);
576+
} catch (e) {
577+
if (e instanceof TypeError && typeof(obj[s]) === 'undefined') {
578+
abort("runner",
579+
"Caught a TypeError while trying to import " +
580+
"suites: a suite is undefined." +
581+
"Check your exports; are you doing something like " +
582+
"exports.suite = vows.describe('foo')." +
583+
"addBatch({}).run()? If so, remove '.run()'");
584+
} else {
585+
throw e;
586+
}
587+
}
575588
return obj[s];
576589
}));
577590
}, [])

0 commit comments

Comments
 (0)