{"name":"should","description":"test framework agnostic BDD-style assertions","version":"3.2.0-beta1","author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"repository":{"type":"git","url":"git://github.com/visionmedia/should.js.git"},"homepage":"https://github.com/visionmedia/should.js","scripts":{"test":"make test"},"devDependencies":{"browserify":"*","mocha":"*","jsdom":"*","jquery":"*","mocha-better-spec-reporter":"0.0.2"},"keywords":["test","bdd","assert"],"main":"./lib/node.js","bugs":{"url":"https://github.com/visionmedia/should.js/issues"},"_id":"should@3.2.0-beta1","dist":{"shasum":"91481d7eb1a8c1329616a8544ccec05c6a47354c","tarball":"http://registry-npm.ywwl.com/should/download/should-3.2.0-beta1.tgz","integrity":"sha512-tcja2262hullv9XztQDaayPuhADPWcDInfkHgFjLuaPVfSQ7g68sLIFFfr7gHeU7jbgl8tgfCZxwbLa9DE2b5w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFOA9V+EnpXprB7EwDpR7BwrkGLvHGDysxzzP6Gm/zFZAiBhPEcNO1jE/Cm+H6Kjjn8iJJzFii5g4U3suuyo3Evpmg=="}],"size":66026,"noattachment":false,"key":"/should/-/should-3.2.0-beta1.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"btd","email":"bardadymchik@gmail.com"},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"gjohnson","email":"gjj391@gmail.com"},{"name":"travisjeffery","email":"tj@travisjeffery.com"},{"name":"btd","email":"bardadymchik@gmail.com"}],"directories":{},"readme":"# should.js\n\n[![Join the chat at https://gitter.im/shouldjs/should.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shouldjs/should.js)\n\n[![Build Status](https://travis-ci.org/shouldjs/should.js.svg?branch=master)](https://travis-ci.org/shouldjs/should.js)\n\n[![Selenium Test Status](https://saucelabs.com/browser-matrix/shouldjs.svg)](https://saucelabs.com/u/shouldjs)\n\n_should_ is an expressive, readable, framework-agnostic assertion library. The main goals of this library are __to be expressive__ and __to be helpful__. It keeps your test code clean, and your error messages helpful.\n\nBy default (when you `require('should')`) _should_ extends the `Object.prototype` with a single non-enumerable getter that allows you to express how that object should behave. It also returns itself when required with `require`.\n\nIt is also possible to use should.js without getter (it will not even try to extend Object.prototype), just `require('should/as-function')`. Or if you already use version that auto add getter, you can call `.noConflict` function.\n\n**Results of `(something).should` getter and `should(something)` in most situations are the same**\n\n### Upgrading instructions\n\nPlease check [wiki page](https://github.com/shouldjs/should.js/wiki/Breaking-changes) for upgrading instructions.\n\n### FAQ\n\nYou can take look in [FAQ](https://github.com/shouldjs/should.js/wiki/FAQ).\n\n## Example\n```javascript\nvar should = require('should');\n\nvar user = {\n    name: 'tj'\n  , pets: ['tobi', 'loki', 'jane', 'bandit']\n};\n\nuser.should.have.property('name', 'tj');\nuser.should.have.property('pets').with.lengthOf(4);\n\n// If the object was created with Object.create(null)\n// then it doesn't inherit `Object.prototype`, so it will not have `.should` getter\n// so you can do:\nshould(user).have.property('name', 'tj');\n\n// also you can test in that way for null's\nshould(null).not.be.ok();\n\nsomeAsyncTask(foo, function(err, result){\n  should.not.exist(err);\n  should.exist(result);\n  result.bar.should.equal(foo);\n});\n```\n## To begin\n\n 1. Install it:\n\n    ```bash\n    $ npm install should --save-dev\n    ```\n\n 2. Require it and use:\n\n    ```js\n    var should = require('should');\n\n    (5).should.be.exactly(5).and.be.a.Number();\n    ```\n\n    ```js\n    var should = require('should/as-function');\n\n    should(10).be.exactly(5).and.be.a.Number();\n    ```\n\n  3. For TypeScript users:\n\n    ```js\n    import * as should from 'should';\n\n    (0).should.be.Number();\n    ```\n\n## In browser\n\nWell, even when browsers by complaints of authors have 100% es5 support, it does not mean it has no bugs. Please see [wiki](https://github.com/shouldjs/should.js/wiki/Known-Bugs) for known bugs.\n\nIf you want to use _should_ in browser, use the `should.js` file in the root of this repository, or build it yourself. To build a fresh version:\n\n```bash\n$ npm install\n$ npm run browser\n```\n\nThe script is exported to `window.should`:\n\n```js\nshould(10).be.exactly(10)\n```\n\nYou can easy install it with npm or bower:\n\n```sh\nnpm install should -D\n# or\nbower install shouldjs/should.js\n```\n\n## API docs\n\nActual api docs generated by jsdoc comments and available at [http://shouldjs.github.io](http://shouldjs.github.io).\n\n## Usage examples\n\nPlease look on usage in [examples](https://github.com/shouldjs/examples)\n\n## .not\n\n`.not` negates the current assertion.\n\n## .any\n\n`.any` allow for assertions with multiple parameters to assert any of the parameters (but not all). This is similar to the native JavaScript [array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some).\n\n# Assertions\n## chaining assertions\n\nEvery assertion will return a `should.js`-wrapped Object, so assertions can be chained.\nTo help chained assertions read more clearly, you can use the following helpers anywhere in your chain: `.an`, `.of`, `.a`, `.and`, `.be`, `.have`, `.with`, `.is`, `.which`. Use them for better readability; they do nothing at all.\nFor example:\n```js\nuser.should.be.an.instanceOf(Object).and.have.property('name', 'tj');\nuser.pets.should.be.instanceof(Array).and.have.lengthOf(4);\n```\nAlmost all assertions return the same object - so you can easy chain them. But some (eg: `.length` and `.property`) move the assertion object to a property value, so be careful.\n\n## Adding own assertions\n\nAdding own assertion is pretty easy. You need to call `should.Assertion.add` function. It accept 2 arguments:\n\n1. name of assertion method (string)\n2. assertion function (function)\n\nWhat assertion function should do. It should check only positive case. `should` will handle `.not` itself.\n`this` in assertion function will be instance of `should.Assertion` and you **must** define in any way this.params object\n in your assertion function call before assertion check happen.\n\n`params` object can contain several fields:\n\n- `operator` - it is string which describe your assertion\n- `actual` it is actual value, you can assume it is your own this.obj if you need to define you own\n- `expected` it is any value that expected to be matched this.obj\n\nYou can assume its usage in generating AssertionError message like: expected `obj`? || this.obj not? `operator` `expected`?\n\nIn `should` sources appeared 2 kinds of usage of this method.\n\nFirst not preferred and used **only** for shortcuts to other assertions, e.g how `.should.be.true()` defined:\n\n```javascript\nAssertion.add('true', function() {\n    this.is.exactly(true);\n});\n```\nThere you can see that assertion function do not define own `this.params` and instead call within the same assertion `.exactly`\nthat will fill `this.params`. **You should use this way very carefully, but you can use it**.\n\nSecond way preferred and i assume you will use it instead of first.\n\n```javascript\nAssertion.add('true', function() {\n    this.params = { operator: 'to be true', expected: true };\n\n    should(this.obj).be.exactly(true);\n});\n```\nin this case this.params defined and then used new assertion context (because called `.should`). Internally this way does not\n create any edge cases as first.\n\n```javascript\nAssertion.add('asset', function() {\n    this.params = { operator: 'to be asset' };\n\n    this.obj.should.have.property('id').which.is.a.Number();\n    this.obj.should.have.property('path');\n})\n\n//then\n> ({ id: '10' }).should.be.an.asset();\nAssertionError: expected { id: '10' } to be asset\n    expected '10' to be a number\n\n> ({ id: 10 }).should.be.an.asset();\nAssertionError: expected { id: 10 } to be asset\n    expected { id: 10 } to have property path\n```\n\n## Additional projects\n\n* [`should-sinon`](https://github.com/shouldjs/sinon) - adds additional assertions for sinon.js\n* [`should-immutable`](https://github.com/shouldjs/should-immutable) - extends different parts of should.js to make immutable.js first-class citizen in should.js\n* [`should-http`](https://github.com/shouldjs/http) - adds small assertions for assertion on http responses for node only\n* [`should-jq`](https://github.com/shouldjs/jq) - assertions for jq (need maintainer)\n* [`karma-should`](https://github.com/seegno/karma-should) - make more or less easy to work karma with should.js\n* [`should-spies`](https://github.com/shouldjs/spies) - small and dirty simple zero dependencies spies\n\n\n## Contributions\n\n[Actual list of contributors](https://github.com/visionmedia/should.js/graphs/contributors) if you want to show it your friends.\n\nTo run the tests for _should_ simply run:\n\n    $ npm test\n\nSee also [CONTRIBUTING](./CONTRIBUTING.md).\n\n## OMG IT EXTENDS OBJECT???!?!@\n\nYes, yes it does, with a single getter _should_, and no it won't break your code, because it does this **properly** with a non-enumerable property.\n\nAlso it is possible use it without extension. Just use `require('should/as-function')` everywhere.\n\n## License\n\nMIT. See LICENSE for details.\n","publish_time":1395309593544,"_cnpm_publish_time":1395309593544,"dist-tags":{"latest":"13.2.3"}}