{"_id":"describe","_rev":"18-6ef849fdb45993cf0fa626f8fa51a770","name":"describe","description":"An extremely lightweight method for running tests.","dist-tags":{"latest":"1.2.0"},"versions":{"0.8.0":{"name":"describe","description":"An extremely lightweight method for running tests.","version":"0.8.0","repository":{"type":"git","url":"git://github.com/yuffster/npm-describe.git"},"dependencies":{"string-color":">= 0.8.0"},"author":{"name":"Michelle Steigerwalt","url":"http://msteigerwalt.com"},"homepage":"http://github.com/yuffster/npm-describe","main":"describe.js","devDependencies":{},"_id":"describe@0.8.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"dist":{"shasum":"5ac519e3d8ee2ce7324e07b3145ade86f1ec2d08","tarball":"https://registry.npmjs.org/describe/-/describe-0.8.0.tgz","integrity":"sha512-woFDl1n2ng6uAcFmKLkj2BpXzxDkdUudGLrQEpRTDtpgVaarClFEQv2qjF+Rx4JqrL4CPbFv9d7dHAySHhVeFw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB2s1bbe/MFK8hG8P1nyCkFpAAgTRBY86rHLdKoRR0qsAiBGHSLIM04Wdo6yUZ5smeYU7nVeX1vNDX2nJeNNgyoh1A=="}]},"scripts":{}},"0.9.0":{"name":"describe","description":"An extremely lightweight method for running tests.","version":"0.9.0","repository":{"type":"git","url":"git://github.com/yuffster/npm-describe.git"},"dependencies":{"string-color":">= 0.8.0"},"author":{"name":"Michelle Steigerwalt","url":"http://msteigerwalt.com"},"homepage":"http://github.com/yuffster/npm-describe","main":"describe.js","devDependencies":{},"_id":"describe@0.9.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"dist":{"shasum":"16878da0c00a2147f11e645f3e946300413509a3","tarball":"https://registry.npmjs.org/describe/-/describe-0.9.0.tgz","integrity":"sha512-YT+d/Te3J8kiVTuyI2yzbRzpucXrN79C63hx7mqh331eQbZJsYWSrZDPG3r7i1NLLWQYjeibHP6UTlkdrHYmdQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHNeAkeSS0luwuNX7QZTlzTTl8j7Ro8S3tWPJL5Zy9KsAiEAjbOEpF5RRbLNdX86A8ljsBp8KLOfILqohHOcKtMOgM4="}]},"scripts":{}},"1.0.0":{"name":"describe","description":"An extremely lightweight method for running tests.","version":"1.0.0","repository":{"type":"git","url":"http://github.com/yuffster/describe"},"dependencies":{"string-color":">= 0.8.0"},"author":{"name":"Michelle Steigerwalt","url":"http://msteigerwalt.com"},"homepage":"http://github.com/yuffster/describe","main":"describe.js","readme":"# describe\n\nDescribe provides a simple method for testing asynchronous and synchronous\ncode within JavaScript projects.\n\n## API Documentation\n\n### describe\n\ndescribe( *groupName*, *tests*[, *options*] );\n\n#### Arguments\n\n- *groupName* (string): A human-readable description of the test group.\n- *tests* (object): An object made up of human-readable test descriptions as \nkeys and functions to run as tests.  Tests functions will be given access to\n`this.expect`.\n- *options*: Configuration options.  Possible values:\n\t- timeout (int): The max amount of time in milliseconds to wait for a test \nto run before timing out.\n\t- callbackMode (string): if set to 'node', this.expect will treat the first\nargument to the callback as an error and the second argument as the result.\n\n### describe.config\n\ndescribe.config( *key*, *value* )\n\nSets the global configuration for tests.\n\n### Synchronous Assertions\n\nthis.expect( *subject*, *expected* )\n\n#### Arguments\n\n- *subject* (mixed): the actual result.\n- *expected* (mixed): the expected result.\n\n#### Example\n\n\tdescribe(\"assertions\", {\n\t\t'basic synchronous expectation': function() {\n\t\t\tthis.expect(42, 42);\n\t\t}\n\t});\n\n### Asynchronous Assertions\n\nBy passing this.expect as the callback parameter to an asynchronous function,\ndescribe will know to wait for the result of the operation before checking to\nsee if the result matches what was expected.\n\nthis.expect( *expected* )\n\n#### Basic Callbacks\n\n\tfunction addNumbersAsync(a, b, callback) {\n\t\tcallback(a+b);\n\t}\n\n\tdescribe(\"assertions\", {\n\t\t'basic asynchronous expectation': function() {\n\t\t\taddNumbersAsync(2, 2, this.expect(4));\n\t\t}\n\t});\n\n#### Node.js-style (e, data) Callbacks\n\n\tfunction addNumbersAsync(a, b, callback) {\n\t\tcallback(null, a+b);\n\t}\n\n\tdescribe(\"assertions\", {\n\t\t'basic asynchronous expectation': function() {\n\t\t\taddNumbersAsync(2, 2, this.expect(4));\n\t\t}\n\t}, { callbackMode: 'node' });\n\n#### Promises-style Callbacks\n\n\tfunction addThingsPromise() {\n\t\tvar n = 0;\n\t\tfor (var i in arguments) n+=arguments[i];\n\t\treturn {\n\t\t\tthen: function(success, failure) {\n\t\t\t\tsuccess(n);\n\t\t\t}\n\t\t};\n\t}\n\n\tdescribe(\"promise callback style\", {\n\t\t'promises-style addition': function() {\n\t\t\tthis.expect(addThingsPromise(2, 2), 4);\n\t\t}\n\t}, {\n\t\tcallbackMode: 'promises'\n\t});\n\n### describe.getResults\n\nAn asynchronous method.  Calls back with the results of all tests described up\nto that point.  You should probably wait until you're done defining tests to\ncall this.\n\n#### Example Results\n\n\t{ \n\t\tpassed: 1,\n\t\ttotal: 2,\n\t\tresults: {\n\t\t\t'sample test group': {\n\t\t\t\tpassed: 1,\n\t\t\t\ttotal: 2,\n\t\t\t\tresults: {\n\t\t\t\t\t'this test passed because its error is null': null,\n\t\t\t\t\t'this test failed because there's an error': [Error]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n### describe.logResults\n\nGets the results and outputs them either to the DOM or the console.","readmeFilename":"README.md","_id":"describe@1.0.0","dist":{"shasum":"6b7de4874b3bbadd7b3c0205c0e72e723c36cb14","tarball":"https://registry.npmjs.org/describe/-/describe-1.0.0.tgz","integrity":"sha512-PkYWSHNkQvnbPTrFIAaTfbiOpW2RvxLUuywTp+sxquvrqX4KbnUzF1cp94IMDgbs6OSD37JoWlMXToENS/jGDA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGly5tPvEwsJO9s3nirChtJZ7/Ch1xsNzDctDW3pd7gtAiB6M1rjEn9Wak4ILkcOCBOu/Vlg3cUvAyoYbYoCR5NTYQ=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"yuffster","email":"msteigerwalt@gmail.com"},"maintainers":[{"name":"yuffster","email":"msteigerwalt@gmail.com"}]},"1.2.0":{"name":"describe","description":"An extremely lightweight method for running tests.","version":"1.2.0","repository":{"type":"git","url":"http://github.com/yuffster/describe"},"dependencies":{"string-color":">= 0.8.0"},"author":{"name":"Michelle Steigerwalt","url":"http://msteigerwalt.com"},"homepage":"http://github.com/yuffster/describe","main":"describe.js","readme":"# describe\n\nDescribe provides a simple method for testing asynchronous and synchronous\ncode within JavaScript projects.\n\n## API Documentation\n\n### describe\n\ndescribe( *groupName*, *tests*[, *options*] );\n\n#### Arguments\n\n- *groupName* (string): A human-readable description of the test group.\n- *tests* (object): An object made up of human-readable test descriptions as \nkeys and functions to run as tests.  Tests functions will be given access to\n`this.expect`.\n- *options*: Configuration options.  Possible values:\n\t- timeout (int): The max amount of time in milliseconds to wait for a test \nto run before timing out.\n\t- callbackMode (string): if set to 'node', this.expect will treat the first\nargument to the callback as an error and the second argument as the result.\n\n### describe.config\n\ndescribe.config( *key*, *value* )\n\nSets the global configuration for tests.\n\n### Synchronous Assertions\n\nthis.expect( *subject*, *expected* )\n\n#### Arguments\n\n- *subject* (mixed): the actual result.\n- *expected* (mixed): the expected result.\n\n#### Example\n\n```javascript\ndescribe(\"assertions\", {\n\t'basic synchronous expectation': function() {\n\t\tthis.expect(42, 42);\n\t}\n});\n```\n\n### Asynchronous Assertions\n\nBy passing this.expect as the callback parameter to an asynchronous function,\ndescribe will know to wait for the result of the operation before checking to\nsee if the result matches what was expected.\n\nthis.expect( *expected* )\n\n#### Basic Callbacks\n\n```javascript\nfunction addNumbersAsync(a, b, callback) {\n\tcallback(a+b);\n}\n\ndescribe(\"assertions\", {\n\t'basic asynchronous expectation': function() {\n\t\taddNumbersAsync(2, 2, this.expect(4));\n\t}\n});\n```\n\n#### Node.js-style (e, data) Callbacks\n\n```javascript\nfunction addNumbersAsync(a, b, callback) {\n\tcallback(null, a+b);\n}\n\ndescribe(\"assertions\", {\n\t'basic asynchronous expectation': function() {\n\t\taddNumbersAsync(2, 2, this.expect(4));\n\t}\n}, { callbackMode: 'node' });\n```\n\n#### Promises-style Callbacks\n\n```javascript\nfunction addThingsPromise() {\n\tvar n = 0;\n\tfor (var i in arguments) n+=arguments[i];\n\treturn {\n\t\tthen: function(success, failure) {\n\t\t\tsuccess(n);\n\t\t}\n\t};\n}\n\ndescribe(\"promise callback style\", {\n\t'promises-style addition': function() {\n\t\tthis.expect(addThingsPromise(2, 2), 4);\n\t}\n}, {\n\tcallbackMode: 'promises'\n});\n```\n\n### describe.getResults\n\nAn asynchronous method.  Calls back with the results of all tests described up\nto that point.  You should probably wait until you're done defining tests to\ncall this.\n\n#### Example Results\n\n```javascript\n{ \n\tpassed: 1,\n\ttotal: 2,\n\tresults: {\n\t\t\"sample test group\": {\n\t\t\tpassed: 1,\n\t\t\ttotal: 2,\n\t\t\tresults: {\n\t\t\t\t\"this test passed because its error is null\": null,\n\t\t\t\t\"this test failed because there's an error\": \"Error or message\"\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\n### describe.logResults\n\nGets the results and outputs them either to the DOM or the console.\n\n### Test Hooks\n\nEach test group supports beforeEach, afterEach, beforeAll, and afterAll as\ntest hooks.\n\n#### Example\n\n```javascript\n(function() {\n\n\tvar arr = [], bowties;\n\n\tdescribe('array stuff', {\n\t\tbeforeAll: function() {\n\t\t\tbowties = 'cool';\n\t\t},\n\t\tbeforeEach: function() {\n\t\t\tarr = arr.concat(1,2,3);\n\t\t},\n\t\tafterEach: function() {\n\t\t\tarr = [];\n\t\t},\n\t\tafterAll: function() {\n\t\t\ttests = null;\n\t\t},\n\t\t'bowties are cool': function() {\n\t\t\tthis.expect(bowties, 'cool');\n\t\t},\n\t\t'arrays have three things': function() {\n\t\t\tthis.expect(arr.length, 3);\n\t\t\tarr.push(5);\n\t\t},\n\t\t'arrays still have three things': function() {\n\t\t\tthis.expect(arr.length, 3);\n\t\t}\n\t});\n\n}());\n```","readmeFilename":"README.md","_id":"describe@1.2.0","dist":{"shasum":"3b42efa6dca1aa2445ef6d15c19854de583711c0","tarball":"https://registry.npmjs.org/describe/-/describe-1.2.0.tgz","integrity":"sha512-GcSTMsJD6d39QuE1Zor671dlY5pDY9IIVLHAidXLrTx6BmMQOyCKEX1btTI781+zA3GQYRcUITi+YoUjFB06UA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHUQ9wrF3s4z/ZbxkjvDuz9mvwiuKHArA6I4g6/pqfquAiBO/IGGYotlnHM9ZB1knXfBjsGmX0NNbeQGr+x1WjqpPw=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"yuffster","email":"msteigerwalt@gmail.com"},"maintainers":[{"name":"yuffster","email":"msteigerwalt@gmail.com"}]}},"maintainers":[{"name":"yuffster","email":"msteigerwalt@gmail.com"}],"time":{"modified":"2022-06-15T01:34:42.443Z","created":"2011-05-15T00:30:57.537Z","0.8.0":"2011-05-15T00:30:58.052Z","0.9.0":"2011-05-16T00:20:42.798Z","1.0.0":"2013-05-30T07:13:27.955Z","1.2.0":"2013-06-11T01:57:42.291Z"},"author":{"name":"Michelle Steigerwalt","url":"http://msteigerwalt.com"},"repository":{"type":"git","url":"http://github.com/yuffster/describe"},"users":{"pressla":true,"huytard":true,"caseysoftware":true,"keshavdulal":true}}