expresso icon indicating copy to clipboard operation
expresso copied to clipboard

expresso hangs if a test script doesn't exports any tests

Open laurie71 opened this issue 13 years ago • 4 comments

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
...

laurie71 avatar Jan 21 '11 01:01 laurie71

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.

bergmark avatar Apr 02 '11 21:04 bergmark

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.

mhemesath avatar May 23 '11 13:05 mhemesath

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.

bergmark avatar May 26 '11 23:05 bergmark

Duplicate issue reported #118

AD7six avatar Aug 01 '11 11:08 AD7six