{"dist":{"shasum":"984e2d490eb4ec196ad24cc52a578cff8cf3d285","tarball":"https://registry.npmjs.org/patr/-/patr-0.2.3.tgz","integrity":"sha512-WoL42sTrGjvZcoe+FKxLNogjjIwVEbqibkVRMSbvuhmPtM3y9zpoQTvzOVhqtI1Qzv9zegOo36ZIME5NdH7bCA==","signatures":[{"sig":"MEUCIC3NHVdslq9h90WlptB/8RTXfVBMvj5+TfY8LsgVY3zHAiEAuaPiYkPcmoWpNnbAimQdnoak05q4eKvxe/e66yo4j0A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib","name":"patr","type":"zip","author":{"name":"Kris Zyp"},"readme":"Promised-based Asynchronous Test Runner (patr) is a very simple, easy-to-use test\nrunner that support asynchronous JavaScript testing with promises. Patr is based on\nthe premise that testing should be as simple as creating an object with\nmethods to perform tests. Objects can be nested to create subgroups of tests.\nPatr relies on the system's \"assert\" module for making assertions. An example test:\n\n    var assert = require(\"assert\");\n    require(\"patr/runner\").run({testMath: function(){\n      assert.equal(3, Math.min(3, 5));\n    });\n\nThe suggested pattern for writing test files is to define the tests on the\nexports object and running the test runner if the module is the main module.\nThis allows for direct execution of test files and easy inclusion of tests\ninto other test groups. For example, we could define \"my-math-test.js\":\n\n    var assert = require(\"assert\");\n    exports.testMath = function(){\n      assert.equal(3, Math.min(3, 5));\n    };\n    \n    if(require.main == module)\n      require(\"patr/runner\").run(exports);\n\nNow we can directly execute \"my-math-test.js\" or we could include it in another\ntest file:\n\n    exports.mathTests = require(\"my-math-test\");\n    exports.otherTests = require(\"other-tests\");\n    \n    if(require.main == module)\n      require(\"patr/runner\").run(exports);\n\nWith these aggregate test module, each test file's tests are included in a nested object\nthat will be tested as a subgroup of tests.\n\nUsing Promises for Asynchronous Testing\n==========================\n\nPromises make asynchronous testing very simple. You simply return a promise from \nyour test to indicate when a test is completed. When using promise-based coding this\nis super simple. For example, to test the contents of file loaded asynchronously using\npromised-io's fs module:\n\n    var fs = require(\"promised-io/fs\");\n\n    exports.testFile = function(){\n      return fs.readFile(\"testfile\").then(function(contents){\n        assert.equal(contents.toString(), \"expected contents\");\n      });\n    };\n    ...\n\nAsynchronous assert module\n======================\n\nPatr includes an \"assert\" module (patr/assert) that is upgraded for promise-based asynchronous\ncode blocks. In particular, the \"throws\" method can be used to enforce that a code block\nwill eventually throw (or reject) even if it happens asynchronously. For example:\n\n    var assert = require(\"patr/assert\");\n    exports.testFile = function(){\n      return assert.throws(function(){\n        // asserts that this must throw/reject eventually\n        return fs.readFile(\"non-existent file\");\n      });\n    };\n\n\nAdvanced Testing\n============\n\nYou can include additional testing options by setting flags on the test objects (that have the test functions).\nThe test object can have the following properties:\n\n* iterations - The number of times to execute the test\n\nThese properties are inherited, if they are set by a parent object, than the children\nobjects will inherit the behavior unlesss it is overriden.\n\nThese properties can also be set from the command line. This is done by including\n-name value arguments when starting the test module. For example:\n\n    nodules test.js -iterations 1000\n\n\nPatr is part of the Persevere project, and therefore is licensed under the\nAFL or BSD license. The Persevere project is administered under the Dojo foundation,\nand all contributions require a Dojo CLA.","scripts":{},"keywords":["test","promise"],"licenses":[{"url":"http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L43","type":"AFLv2.1"},{"url":"http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L13","type":"BSD"}],"location":"http://github.com/kriszyp/patr/zipball/master","mappings":{"promised-io":"http://github.com/kriszyp/promised-io/zipball/v0.2.1"},"githubName":"patr","repository":{"url":"http://github.com/kriszyp/patr","type":"git"},"description":"Promised-based Asynchronous Test Runner (patr) is a very simple, easy-to-use test runner that support asynchronous JavaScript testing with promises. Patr is based on the premise that testing should be as simple as creating an object with methods to perform tests. Objects can be nested to create subgroups of tests. Patr relies on the system's \"assert\" module for making assertions. An example test:","directories":{"lib":"./lib"},"maintainers":[{"name":"Kris Zyp","email":"kriszyp@gmail.com"}],"contributors":[],"dependencies":{"promised-io":"0.2.2"},"_id":"patr@0.2.3","version":"0.2.3"}