expresso
expresso copied to clipboard
expresso hangs if a test script doesn't exports any tests
If you run expresso on a script with no tests exported, expresso hangs indefinatly, with or without a timeout option:
$ cat test.js
// disabled
// exports['test'] = function() { ... }
$ expresso -t 500 tests.js
...
As far as I can tell, the timeout is for running tests, not waiting for tests to be added, so that's why it freezes.
It would probably be nice to have a separate timeout for this though. Tests added async will probably not need a big timeout and in my experience it's common to add the exports incorrectly.
I just ran into this issue as well. Added a placeholder test file with the intention of adding tests. I got distracted, and attempted to fix a different issue first before adding tests to the new file. That is when I noticed the hang. The empty file was getting executed by expresso because I run all my tests in batch via makefile.
I think a warning in the output would suffice that an empty test file is being loaded? I think that would be enough to trigger the 'oh duh' moment that there are no tests in the file yet, causing the issue.
I finally got around to implementing this.
With https://github.com/visionmedia/expresso/pull/99 --timeout now also controls how long to wait for tests to be added, otherwise an error is thrown specifying which file is the culprit.
Duplicate issue reported #118