cloudkick / whiskey

Whiskey is a powerful test runner for Node.js applications and a process orchestration framework which makes running integration tests with a lot of service / process dependencies easier.
Apache License 2.0
251 stars 27 forks source link

Uncaught exception logic is faulty. #58

Open sam-falvo opened 11 years ago

sam-falvo commented 11 years ago

While attempting to add a means of signalling an exception generated outside the context of a test to Whiskey, I happened upon another bug with respect to exceptions within the context of a test.

To reproduce:

  1. Edit lib/common.js and insert this text on line 425: throw { message: 'hello world' };
  2. Invoke Whiskey (see results below for how I invoked it).

Apparently, the _testObj member of the TestFile class is not being initialized.

$ NODE_PATH=$(pwd)/lib-cov bin/whiskey --coverage --coverage-reporter cli --coverage-file /tmp/hooey --coverage-dir /tmp -t example/test-bdd.js                                                                                                                                                                   /Users/sfalvo/git/whiskey :: Mon Jun 10 15:32:34 PDT 2013
path.existsSync is now called `fs.existsSync`.
/Users/sfalvo/git/whiskey/example/test-bdd.js

Stderr:

/Users/sfalvo/git/whiskey/lib/common.js:553
    test._testObj.finish();
                  ^
TypeError: Cannot call method 'finish' of null
    at TestFile.addUncaughtException (/Users/sfalvo/git/whiskey/lib/common.js:553:19)
    at process.<anonymous> (/Users/sfalvo/git/whiskey/lib/run_test_file.js:116:12)
    at process.EventEmitter.emit (events.js:95:17)
    at process._fatalException (node.js:272:26)
Kami commented 11 years ago

@sam-falvo Can you please provide a link to the line in a file where this happens / patch which reproduces this?

Also, judging by the exception this doesn't seem to happen in the context of a test, although I might be wrong.

sam-falvo commented 11 years ago

See https://github.com/cloudkick/whiskey/pull/59