{"name":"whiskey","description":"A simple test runner for NodeJS applications.","version":"0.8.0-alpha","author":{"name":"Cloudkick, Inc.","email":"tomaz+npm@cloudkick.com"},"keywords":["whiskey","tests","test runner","testing","tdd","coverage","test coverage"],"homepage":"https://github.com/cloudkick/whiskey","repository":{"type":"git","url":"git://github.com/cloudkick/whiskey.git"},"directories":{"lib":"./lib","example":"./example","bin":"./bin"},"scripts":{"test":"make test"},"dependencies":{"sprintf":">= 0.1.1","async":">= 0.1.22","magic-templates":"= 0.1.1","rimraf":"= 1.0.1","terminal":"= 0.1.3","gex":"= 0.0.1","simplesets":"= 1.1.6","logmagic":"= 0.1.4","underscore":">= 1.4.2"},"engines":{"node":">= 0.4.0"},"main":"./index","bin":{"whiskey":"./bin/whiskey"},"licenses":[{"type":"Apache","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}],"readme":"# Whiskey\n\nWhiskey is a powerful test runner for Node.js applications and a process\norchestration framework which makes running integration tests with a lot of\nservice / process dependencies easier.\n\n## Features\n\n* Each test file runs isolated in a separate process\n* Support for running multiple tests in parallel in a single suite (`--concurrency` option)\n* Support for running multiple suites in parallel (`--independent-tests` option)\n* Support for a test initialization function which is run before running the tests in a test file\n* Support for a test file timeout\n* Per-test `setUp` / `tearDown` function support\n* Per-suite (test file) `initialize` / `finalize` function support\n* Per-session, or global, setUp / tearDown function support\n* Support for different test reporters (cli, tap)\n* Support for code coverage (cli reporter, html reporter)\n* Support for reporting variables which have leaked into a global scope\n* Nicely formatted reports (colors!)\n* Integration with node debugger\n* Support for generating Makefiles with different Whiskey targets\n\n## Non NPM-installable Dependencies\n\n* [node-jscoverage](https://github.com/Kami/node-jscoverage) (only required if `--coverage` option is used)\n\n## Changes\n\nFor changes please see [CHANGES.md](/cloudkick/whiskey/blob/master/CHANGES.md) file.\n\n## Installation\n\nInstall it using npm:\n\n```\nnpm install whiskey\n```\n\n## Usage\n\n    whiskey [options] --tests \"<test files>\"\n\n    whiskey [options] --independent-tests \"<test files>\"\n\n    whiskey [options] --tests \"<test files>\"  --independent-tests \"<test files>\"\n\n\n### Available options\n\n * **-t, --tests** - Whitespace separated list of test suites to run sequentially\n * **-T, --independent-tests** - Whitespace separated list of test suites to run concurrently\n * **-m, --max-suites NUMBER** - The number of concurrently executing independent test suites (defaults to 5)\n * **-ti, --test-init-file** - A path to the initialization file which must export\n `init` function and it is called in a child process *before running the tests in\n each test file\n * **-c, --chdir** - An optional path to which the child process will chdir to before\n running the tests\n * **-g, --global-setup-teardown STRING** - Specifies the file containing the globalSetUp and globalTearDown procedures.\n * **--timeout [NUMBER]** - How long to wait for tests to complete before timing\n out\n * **--failfast** - Stop running the tests on a first failure or a timeout\n * **--no-styles** - Don't use styles and colors\n * **--concurrency [NUMBER]** - Maximum number of tests which will run in parallel (defaults to 1)\n * **--quiet** - Don't print stdout and stderr\n * **--real-time** - Print stdout and stderr as soon as it comes in\n * **--test-reporter [cli,tap]** - Which test reporter to use (defaults to cli)\n * **--coverage** - Use this option to enable the test coverage\n * **--coverage-reporter [cli,html]** - Which coverage reporter to use (defaults to cli)\n * **--coverage-dir** - Directory where the coverage HTML report is saved\n * **--scope-leaks** - Record which variables were leaked into a global scope\n * **--scope-leaks-reporter [cli]** - Which scope leak reporter to use (defaults\n   to cli)\n * **--debug** - Attach a Node debugger to the test process\n * **--report-timing** - Report each test run time\n * **--dependencies STRING** - Specify path to the dependencies file for the\n   process runner. More information about the process runner can be found at\n   [PROCESS_RUNNER.md](/cloudkick/whiskey/blob/master/PROCESS_RUNNER.md)\n * **--only-essential-dependencies** - Only start dependencies required by the tests\n   files which are ran. This option is only applicable if `--dependencies` option\n   is used.\n\nNote: When specifying multiple test a list with the test paths must be quoted,\nfor example: `whiskey --tests \"tests/a.js tests/b.js tests/c.js\"`\n\n## A Note about setUp and tearDown\n\nPresently, two kinds of setup and teardown procedures exist with Whiskey.\nsetUp and tearDown work on a per-suite basis; that is, Whiskey invokes setUp\nprior to running _all_ tests in a given Javascript file, called a suite, and\ninvokes tearDown after all tests in that file have been exhausted.  If you run\nmultiple suites in parallel (e.g., via the -T/--independent-tests option),\nyou'll get concurrent execution of setups and teardowns as well.\n\nSometimes, though, you need longer-lived environmental configurations, or you\nneed safe resource sharing between entire batches of independently running\ntests. For these, you'll want to use globalSetUp and globalTearDown.\n\n * When do I use setUp / tearDown?\n   * When a suite's runtime environment **does not** influence other running suites.\n   * **Example:** . . .\n * When do I use globalSetUp / globalTearDown ?\n   * When a suite's runtime environment **can potentially** interfere with other, concurrently running suites.\n   * **Example:** Attempting to run multiple suites in parallel which rely on a Cassandra schema being in place, and each attempting to reset the schema to a known state on a single Cassandra instance, you'll get Cassandra schema version errors.  Using globalSetUp prevents this by running the schema reset code exactly once for _all_ tests.\n\n## Test File Examples\n\nA simple example (success):\n\n```javascript\nvar called = 0;\n\nexports.test_async_one_equals_one = function(test, assert) {\n  setTimeout(function() {\n    assert.equal(1, 1);\n    called++;\n    test.finish();\n  }, 1000);\n};\n\nexports.tearDown = function(test, assert) {\n  assert.equal(called, 1);\n  test.finish();\n};\n```\n\nA simple example (skipping a test):\n\n```javascript\nvar dbUp = false;\n\nexports.test_query = function(test, assert) {\n  if (!dbUp) {\n    test.skip('Database is not up, skipping...');\n    return;\n  }\n\n  assert.equal(2, 1);\n  test.finish();\n};\n```\n\nA simple example (failure):\n\n```javascript\nexports.test_two_equals_one = function(test, assert) {\n  assert.equal(2, 1);\n  test.finish();\n};\n```\n\nA simple example using the optional BDD module:\n```javascript\nvar bdd = require('whiskey').bdd.init(exports);\nvar describe = bdd.describe;\n\ndescribe('the bdd module', function(it) {\n  it('supports it(), expect(), and toEqual()', function(expect) {\n    expect(true).toEqual(true);\n  });\n});\n```\n\nA simple example demonstrating how to use global setup and teardown functionality:\n``` javascript\nexports['globalSetUp'] = function(test, assert) {\n  // Set up database schema here...\n  // Push known data set to database here...\n  test.finish();\n}\n\nexports['globalTearDown'] = function(test, assert) {\n  // Drop database here...\n  test.finish();\n}\n```\n\nFor more examples please check the `example/` folder, and the `test/run.sh` script.\n\n## Build status\n\n[![Build Status](https://secure.travis-ci.org/cloudkick/whiskey.png)](http://travis-ci.org/cloudkick/whiskey)\n\n## Running Whiskey test suite\n\nTo run the Whiskey test suite, run the following command in the repository root\ndirectory.\n\n```bash\nnpm test\n```\n\nIf all the tests have sucessfully passed, the process should exit with a zero\nstatus code and you should see `* * * Whiskey test suite PASSED. * * *`\nmessage.\n\n## Contributing\n\nTo contribute, fork the repository, create a branch with your changes and open a\npull request.\n\n## Debugging\n\nIf you want to debug your test, you can use the `--debug` option. This will\ncause Whiskey to start the test process with the V8 debugger attached to it\nand put you into the Node debugger prompt.\n\nWhiskey will also by default set a breakpoint at the beginning of your test\nfile.\n\nNote: This option can only be used with a single test file.  Further, you\ncannot use the `--debug` and `--independent-tests` options together.  The\nsemantics just don't make any sense.  To debug a test, make sure you invoke it\nwith `--tests` instead.\n\n## Troubleshooting\n\n### I use `long-stack-straces` module in my own code and all of the tests get reported as succeeded\n\nLong stack traces modules intercepts the default Error object and throws a custom\none. The problem with this is that Whiskey internally relies on attaching the\ntest name to the `Error` object so it can figure out to which test the exception\nbelongs. long-stack-traces throws a custom Error object and as a consequence test\nname attribute gets lost so Whiskey thinks your test didn't throw any exceptions.\n\nThe solution for this problem is to disable `long-stack-trace` module when running\nthe tests. This shouldn't be a big deal, because Whiskey internally already uses\n`long-stack-traces` module which means that you will still get long stack traces\nin the exceptions which were thrown in your tests.\n\n### My test gets reported as \"timeout\" instead of \"failure\"\n\nIf your test gets reported as \"timeout\" instead of \"failure\" your test code most\nlikely looks similar to the one below:\n\n```javascript\nexports.test_failure = function(test, assert){\n  setTimeout(function() {\n    throw \"blaaaaah\";\n    test.finish();\n  },200);\n};\n```\n\nThe problem with this is that if you run tests in parallel (`--concurrency` > 1)\nand you don't use a custom assert object which gets passed to each test function,\nWhiskey can't figure out to which test the exception belongs. As a consequence,\nthe test is reported as \"timed out\" and the exception is reported as \"uncaught\".\n\nThe solution for this problem is to run the tests in sequential mode (drop the\n--concurrency option).\n\n## License\n\nApache 2.0, for more info see [LICENSE](/cloudkick/whiskey/blob/master/LICENSE).\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/cloudkick/whiskey/issues"},"_id":"whiskey@0.8.0-alpha","dist":{"shasum":"6a16daee8bd6e47e3df45cf265cc1cde281bf61d","tarball":"http://registry-npm.ywwl.com/whiskey/download/whiskey-0.8.0-alpha.tgz","integrity":"sha512-FI8J8+e8MUQ/9nx36jQB0U4/bu4FtF4h46+sLGNQezA89EzV562gsoqK/J9ii7iRReDgLu4QsListiGiPcOuBA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCiLZC6jRFjeIGbbSr2Pz3YSZFgvCgRl/NfOBXp+176LAIhAN7D+BKWet8UlXnmVxwb0g4chJ7qs5HZNrneZIKkJ2V0"}],"size":107029,"noattachment":false,"key":"/whiskey/-/whiskey-0.8.0-alpha.tgz"},"_from":".","_npmVersion":"1.2.21","_npmUser":{"name":"kami","email":"tomaz+npm@tomaz.me"},"maintainers":[{"name":"kami","email":"tomaz@tomaz.me"}],"publish_time":1369093116320,"_cnpm_publish_time":1369093116320,"dist-tags":{"latest":"0.8.4"}}