Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
Generated Vendored Executable
+14
View File
@@ -0,0 +1,14 @@
Before contribute something:
Follow simple rules:
- Not violate [DRY](http://programmer.97things.oreilly.com/wiki/index.php/Don%27t_Repeat_Yourself).
- [Boy Scout Rule](http://programmer.97things.oreilly.com/wiki/index.php/The_Boy_Scout_Rule) needs to have been applied.
1. Your code should look like all the other code - this project should look like it was written by one person, always.
2. If you want to propose something - just create an issue and describe your question with as much description as you can.
3. Please never send issues or pull requests about code style, jshint violations etc - I do not accept it (and you will spend your time for free).
4. If you think you have some general improvement, consider creating a pull request with it.
5. If you are not sure whether your improvement is general enough, just create your own plugin for should.js. (see should.use and Assertion.add usage).
6. If you add new code, it should be covered by tests. No tests - no code.
7. If you find a bug (or at least you think it is a bug), create an issue with the library version and test case that I can run and see what are you talking about, or at least full steps by which I can reproduce it.
Generated Vendored Executable
+554
View File
@@ -0,0 +1,554 @@
# 13.2.3 / 2018-07-30
* `.only.keys` throws when no `Object.prototype.should`
# 13.2.2 / 2018-07-26
* Updates for TS definition
# 13.2.1 / 2018-01-12
* Fix `.size` to work with should/as-function
# 13.2.0 / 2017-12-27
* Update type adaptors to allow to use Set as iterable everywhere
# 13.1.3 / 2017-10-28
* Fix weird bug in `.containDeep` when given object is string (see \#157)
# 13.1.2 / 2017-10-10
* Revert default export in TS definition (added in 13.1.0)
# 13.1.1 / 2017-10-07
* Added missing return type for `.rejectedWith` in typescript definition
# 13.1.0 / 2017-09-20
* Added `.resolved` as alias to `.fulfilled`
* Added `.resolvedWith` as alias to `.fulfilledWith`
* All zero argument assertion will throw `TypeError` if any arg passed
* Fix default export for TS definition
# 13.0.1 / 2017-09-06
* Add missing UMD bundle for browser
# 13.0.0 / 2017-09-05
* Removed `.enumerable` and `.enumerables`
* Fixed `.match`ing on `Date`s
* Added TypeScript definitions
# 12.0.0 / 2017-08-28
* Update `should-equal` to 2.x
* Update entry points to do the same thing (global should entry)
# 11.2.1 / 2017-03-09
* Fix `.match(regex)` for not supported cases
# 11.2.0 / 2017-01-27
* Added `.only` modifier for `.keys` to check also size
* Soft deprecate `.enumerable(s)`
# 11.1.2 / 2016-12-10
* Added workaround for runtimes where error's stack populated eagerly
# 11.1.1 / 2016-10-10
* Update modules
# 11.1.0 / 2016-08-14
* Update modules
# 11.0.0 / 2016-08-10
* Extracted parts from code for traversing different data types in similar ways.
This allows for easily extending the library to almost any collection class.
Now should.js supports `Set`/`Map`/`WeakSet`/`WeakMap` everywhere.
* `.empty()` now uses new type adaptors
* Breaking change in `.keys()`/`.key()`: now only checks for passed keys (also uses type adaptors) - it can check for keys in `Map`/`Set` e.g
* Added `.value(key, value)` to assert if key-value object has such `value` with this `key`
* Added `.size()` to get size of collection; also works with type adaptors
* `.containEql` uses type adaptors and can check something contained within a collection or sub-part of a key-value object
# 10.0.0 / 2016-07-18
* Possible breaking change/bugfix in should-format when in objects used keys that looks like a numbers
# 9.0.2 / 2016-06-10
* Small test fixes for function expressions without names in Chrome
# 9.0.1 / 2016-06-09
* Fix browser global export
# 9.0.0 / 2016-05-30
* Set should.config values to be more obvious. Pls check breaking changes page for exact values.
* Add support for SIMD data types.
* Fixed minor bugs in .eql
* Allow to show all equality check fails in .eql
# 8.4.0 / 2016-05-21
* Add support for Symbols in .eql
# 8.3.2 / 2016-05-18
* Fix for `should-equal` to do not call .toString when checking circular usage
# 8.3.1 / 2016-04-15
* Fix browser script to again be UMD bundle
# 8.3.0 / 2016-03-23
* .true() and .false() can accept optional message to be used in assertion Error
* Add more useful messages to promise assertions
# 8.2.2 / 2016-02-09
* Fix bug with .match when called primitive to match object
* Various linting issues
# 8.2.1 / 2016-01-27
* Fix bug with new option, thanks @VinGarcia
# 8.2.0 / 2016-01-24
* Add option to should.equal to treat -0 and +0 as equals
# 8.1.1 / 2016-01-10
* Fix browser build to do not loose window.Should
# 8.1.0 / 2016-01-10
* Add .Date() assertion to test if given object is Date instance
# 8.0.2 / 2015-12-18
* Update should-format to fix bug in formatting arrow functions
# 8.0.1 / 2015-12-11
* Fix throwing TypeError in .match
# 8.0.0 / 2015-12-08
* Move should-promised to main repo
* Expose window.should as should function and not a getter
# 7.1.1 / 2015-10-20
* Update format package to fix node 0.12 Symbol formatting
# 7.1.0 / 2015-08-28
* Added .aboveOrEqual and .belowOrEqual for numbers (<= and >=)
* Added .oneOf and .equalOneOf to check equality of one of values
* Added 'browser' field to package.json
# 7.0.4 / 2015-08-14
* Missing doc for .deepEqual
* Fix .match and dependent assertions to check property in object-object matching
# 7.0.3 / 2015-08-09
* Add alias .deepEqual for .eql
# 7.0.2 / 2015-07-09
* Bug in browser script and build
# 7.0.1 / 2015-06-18
* Fixes in should-type for dom nodes, host object and promises
# 7.0.0 / 2015-06-18
* Added support to `.eql` es6 set, map and symbol (`should-type`, `should-format`, `should-equal`)
* **Breaking Change** More accurate work with types (dom nodes, typed-arrays).
* **Breaking Change** Change result of should-type to be more accurate and consistent.
* Fixed should-equal options checks
* Fixed should-format typed arrays (more then 8 bits)
* Added aliases: .matchEach => .matchSome, .matchAny => .matchEvery (to be similar to array methods). See #65.
* **Breaking Change (possibly)** .matchEach and .matchAny now uses internally .match. See #65.
* **Breaking Change** No more getter assertions. No all assertions are functions.
* **Breaking Change** No more proxy returning, to check property names.
* **Breaking Change** `should-format` now looks more like chrome developer tools inspections.
# 6.0.3 / 2015-05-18
* Replace rest of usage after 6.0.2
# 6.0.2 / 2015-05-18
* Replace in all internal assertions `should` usage to non getter form
# 6.0.1 / 2015-04-15
* Remove dummy debug messages
# 6.0.0 / 2015-04-15
* From .containDeep\* removed .indexOf checks for strings, now it is just equality checks (see #55)
* Fix for .not.throws for generators
# 5.2.0 / 2015-03-12
* Added `.matchAny`, like `.matchEach` but with `some` semantics
# 5.1.0 / 2015-03-05
* Initial support of es6 generators, iterables, iterators and symbols
* .throwError now support generator functions
* Fix bug in .propertyByPath
# 5.0.1 / 2015-02-21
* Export utils via should.util
# 5.0.0 / 2015-02-10
* Remove old .eql implementation
* Refactor nested errors
* Added separate reporting message for false negative results like 10.should.not.equal(10)
* Make error.message lazy fix old performance bottlenecks for constructing messages for big objects
* Added .propertyWithDescriptor
# 4.6.5 / 2015-02-05
* Fix performance degradation on large objects
# 4.6.4 / 2015-02-05
* Fix end cases for .containDeep and .containDeepOrdered
# 4.6.3 / 2015-02-01
* Added small check for .noConflict
* Fix end cases for .containDeep and .containDeepOrdered
# 4.6.2 / 2015-01-28
* Make assertion properties configurable
# 4.6.1 / 2015-01-18
* Bump deps
* Set showDiff only if the same types
# 4.6.0 / 2015-01-13
* Wrap everywhere returned assertion with Proxy if available.
# 4.5.2 / 2015-01-13
* Fixed null properties in .containDeep and .containDeepOrdered
# 4.5.1 / 2015-01-13
* Fixed leaked \_eql
# 4.5.0 / 2015-01-11
* Added config flag .useOldDeepEqual to use old .eql implementation
# 4.4.4 / 2015-01-08
* Added .enumerables
# 4.4.3 / 2015-01-08
* Bump dependencies to get more accurate format of promise
* Added a lot of jsdocs
# 4.4.2 / 2014-12-27
* Remove breaking change with should-equal that check also object prototypes. Instead document how get both behaviours in .eql docs.
# 4.4.1 / 2014-12-13
* bump deps
# 4.4.0 / 2014-12-12
* assert methods reimplemented via assertion, deepEqual done via should-equal. To avoid possible confusion between should.deepEqual and a.should.eql(b)
* Possible fix for error tests
# 4.3.1 / 2014-12-08
* `.throw()` check if given object is a function
# 4.3.0 / 2014-11-10
* Remove node's version of .eql
* Added reason why .eql failed
# 4.2.1 / 2014-11-07
* Move inspection from .formattedObj to be in .getMessage - to make inspection as late as possible.
# 4.2.0 / 2014-11-06
* Remove node util.inspect and use instead own inspection module with type detection and browser types compatibility
# 4.1.0 / 2014-10-19
* As inspect function was moved to repo, refine how it show Dates (added millis via custom format)
* Added warnings for potential shoot in the leg: eql non strict and should unwrapping primitive wrappers
* Added possibility to disable any warnings via environment variable SHOULDJS_WARN and should.warn = false
* Added new deep equality check function
* Nested assertions can contribute to parent assertions own messages
# 4.0.4 / 2014-06-09
* Make all assertions enumerable in Assertion.prototype
# 4.0.3 / 2014-06-09
* Fix wrong/strange behaviour of .containDeep with equal keys. Now it check to contain element once.
* Added util.formatProp to format properties more accurate
# 4.0.1 / 2014-06-04
* Missing name in browser script
# 4.0.0 / 2014-05-29
* Breaking change: Move non core assertions out
* Added casting in properties assertions to String for all property names
* Added .propertyByPath assertion
* Breaking change: Remove deprecated .includeEql and .include
* Breaking change: .containDeep now do not check order for 2 arrays case
* Added .containDeepOrdered for old .containDeep
* Added support of array-like objects
* Added to .throw matching by error properties with .match
# 3.3.2 / 2014-05-23
* Fix for should.format
# 3.3.1 / 2014-04-16
* Added aliases for es reserved words
* Fix bug with ownProperty alias
* Fix bug with not function alias
# 3.3.0 / 2014-04-07
* Added .enumerable(name, val)
# 3.2.0 / 2014-03-29
* Added first version of .any modifier that affect assertions with multiple parameters
* .header now have more nice message
* assertion can now override how to show object
# 3.1.4 / 2014-03-18
* .Error now do not throw assertion error for custom errors.
# 3.1.3 / 2014-02-25
* Fix TypeError in .containEql
# 3.1.2 / 2014-01-28
* Fix for adding .inspect for JQuery object only in case when it is exist
# 3.1.1 / 2014-01-28
* Fix for HTMLElement in DOM less environments
# 3.1.0 / 2014-01-23
* Added jquery based browser extension
# 3.0.1 / 2014-01-17
* Fix: .lengthOf()
# 3.0.0 / 2014-01-17
* Split everything to smaller files
* Added huge extension to .match and .matchEach. Thanks @alsotang for initial code and idea.
* Added .containDeep and .containEql
* Separate build for browser and node.js
* Basic plugin system
* Breaking change: .Object now do not fail on arrays
* Breaking change: Additional messages now replaces generated and do not added
* Breaking change: .keys now check as is - no keys in args means no keys in object
* Deprecated: assert extension
* Deprecated: .include and .includeEql
* Now all assertions define only positive cases, should.js take care about negations and chains
# 2.1.1 / 2013-12-05
* Move date formatting out of should.inspect
# 2.1.0 / 2013-11-11
* Override .inspect for Date's to convert them to ISOString
# 2.0.2 / 2013-10-21
* Add '#of' as getter for chaining.
* Exclude browser script for .npmignore.
# 2.0.1 / 2013-10-10
* Fix wrong path in .npmignore.
# 2.0.0 / 2013-10-10
* breaking change: #a now getter like #an. Was replaced with #type(str)
* breaking change: #empty does not check length for objects. Now it check if object do not have own properties.
* #properties check if object have some properties
* util.inspect now exposed as should.inspect
* assertions for NaN, Infinity, Array, Object, String, Boolean, Number, Error, Function
* #equal got alias #exactly
# 1.3.0 / 2013-09-13
* fix doc for .keys. Closes #108.
* add #endWith()
* add .startWith (#119)
# 1.2.2 / 2013-02-19
* fix should.be.instanceOf() failure on Date
# 1.2.1 / 2012-11-02
* add .showDiff
* Make instanceOf and throwError be aliased like others [alFReD-NSH]
* Fix should[.not].exist not having stack trace #84 [alFReD-NSH]
# 1.2.0 / 2012-09-21
* Added #approximately(value, delta, description) for doing assertions on results of operations with numbers. [titarenko]
# 1.1.1 / 2012-09-19
* add .type for eql()s assert
# 1.1.0 / 2012-07-30
* add enclosing of failure message functions. Closes #81
* add mocha .actual / .expected string support for all assertion values
# 0.7.0 / 2012-07-17
* add `.throw(Constructor)` support [snakamura]
# 0.6.3 / 2012-04-26
* Added object inclusion support back
# 0.6.2 / 2012-04-26
* Added homepage to package.json
* Fixed .equal() with dates. Closes #63
# 0.6.1 / 2012-04-10
* package: add "repository" section [TooTallNate]
* use valueOf() to get the reference the object [TooTallNate]
# 0.6.0 / 2012-03-01
* Added `err.actual` and `err.expected` for .{eql,equal}()
* Added 'return this;' to 'get json' and 'get html' in order to provide chaining for should.be.json and should.be.html
# 0.5.1 / 2012-01-13
* Added better `.json`
* Added better `.html`
# 0.5.0 / 2012-01-12
* Added string matching to `.throw()` [serby]
* Added regexp matching to `.throw()` [serby]
* Added `.includeEql()` [RubenVerborgh]
* Added `.should.be.html`
* Added `.should.be.json`
* Added optional description args to most matchers [Mike Swift]
# 0.4.2 / 2011-12-17
* Fixed .header() for realzzz
# 0.4.1 / 2011-12-16
* Fixed: chain .header() to retain negation
# 0.4.0 / 2011-12-16
* Added `.should.throw()`
* Added `.include()` support for strings
* Added `.include()` support for arrays
* Removed `keys()` `.include` modifier support
* Removed `.object()`
* Removed `.string()`
* Removed `.contain()`
* Removed `.respondTo()` rubyism
* expresso -> mocha
# 0.3.2 / 2011-10-24
* Fixed tests for 0.5.x
* Fixed sys warning
# 0.3.1 / 2011-08-22
* configurable
# 0.3.0 / 2011-08-20
* Added assertion for inclusion of an object: `foo.should.include.object({ foo: 'bar' })`
# 0.2.1 / 2011-05-13
* Fixed .status(code). Closes #18
# 0.2.0 / 2011-04-17
* Added `res.should.have.status(code)` method
* Added `res.should.have.header(field, val)` method
# 0.1.0 / 2011-04-06
* Added `should.exist(obj)` [aseemk]
* Added `should.not.exist(obj)` [aseemk]
# 0.0.4 / 2010-11-24
* Added `.ok` to assert truthfulness
* Added `.arguments`
* Fixed double required bug. [thanks dominictarr]
# 0.0.3 / 2010-11-19
* Added `true` / `false` assertions
# 0.0.2 / 2010-11-19
* Added chaining support
# 0.0.1 / 2010-11-19
* Initial release
Generated Vendored Executable
+20
View File
@@ -0,0 +1,20 @@
Copyright(c) 2010-2013 TJ Holowaychuk <tj@vision-media.ca>
Copyright(c) 2013-2017 Denis Bardadym <bardadymchik@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Generated Vendored Executable
+223
View File
@@ -0,0 +1,223 @@
# should.js
[![Join the chat at https://gitter.im/shouldjs/should.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shouldjs/should.js)
[![Build Status](https://travis-ci.org/shouldjs/should.js.svg?branch=master)](https://travis-ci.org/shouldjs/should.js)
[![Selenium Test Status](https://saucelabs.com/browser-matrix/shouldjs.svg)](https://saucelabs.com/u/shouldjs)
_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.
By 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`.
It 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.
**Results of `(something).should` getter and `should(something)` in most situations are the same**
### Upgrading instructions
Please check [wiki page](https://github.com/shouldjs/should.js/wiki/Breaking-changes) for upgrading instructions.
### FAQ
You can take look in [FAQ](https://github.com/shouldjs/should.js/wiki/FAQ).
## Example
```javascript
var should = require('should');
var user = {
name: 'tj'
, pets: ['tobi', 'loki', 'jane', 'bandit']
};
user.should.have.property('name', 'tj');
user.should.have.property('pets').with.lengthOf(4);
// If the object was created with Object.create(null)
// then it doesn't inherit `Object.prototype`, so it will not have `.should` getter
// so you can do:
should(user).have.property('name', 'tj');
// also you can test in that way for null's
should(null).not.be.ok();
someAsyncTask(foo, function(err, result){
should.not.exist(err);
should.exist(result);
result.bar.should.equal(foo);
});
```
## To begin
1. Install it:
```bash
$ npm install should --save-dev
```
2. Require it and use:
```js
var should = require('should');
(5).should.be.exactly(5).and.be.a.Number();
```
```js
var should = require('should/as-function');
should(10).be.exactly(5).and.be.a.Number();
```
3. For TypeScript users:
```js
import * as should from 'should';
(0).should.be.Number();
```
## In browser
Well, 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.
If 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:
```bash
$ npm install
$ npm run browser
```
The script is exported to `window.should`:
```js
should(10).be.exactly(10)
```
You can easy install it with npm or bower:
```sh
npm install should -D
# or
bower install shouldjs/should.js
```
## API docs
Actual api docs generated by jsdoc comments and available at [http://shouldjs.github.io](http://shouldjs.github.io).
## Usage examples
Please look on usage in [examples](https://github.com/shouldjs/examples)
## .not
`.not` negates the current assertion.
## .any
`.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).
# Assertions
## chaining assertions
Every assertion will return a `should.js`-wrapped Object, so assertions can be chained.
To 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.
For example:
```js
user.should.be.an.instanceOf(Object).and.have.property('name', 'tj');
user.pets.should.be.instanceof(Array).and.have.lengthOf(4);
```
Almost 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.
## Adding own assertions
Adding own assertion is pretty easy. You need to call `should.Assertion.add` function. It accept 2 arguments:
1. name of assertion method (string)
2. assertion function (function)
What assertion function should do. It should check only positive case. `should` will handle `.not` itself.
`this` in assertion function will be instance of `should.Assertion` and you **must** define in any way this.params object
in your assertion function call before assertion check happen.
`params` object can contain several fields:
- `operator` - it is string which describe your assertion
- `actual` it is actual value, you can assume it is your own this.obj if you need to define you own
- `expected` it is any value that expected to be matched this.obj
You can assume its usage in generating AssertionError message like: expected `obj`? || this.obj not? `operator` `expected`?
In `should` sources appeared 2 kinds of usage of this method.
First not preferred and used **only** for shortcuts to other assertions, e.g how `.should.be.true()` defined:
```javascript
Assertion.add('true', function() {
this.is.exactly(true);
});
```
There you can see that assertion function do not define own `this.params` and instead call within the same assertion `.exactly`
that will fill `this.params`. **You should use this way very carefully, but you can use it**.
Second way preferred and i assume you will use it instead of first.
```javascript
Assertion.add('true', function() {
this.params = { operator: 'to be true', expected: true };
should(this.obj).be.exactly(true);
});
```
in this case this.params defined and then used new assertion context (because called `.should`). Internally this way does not
create any edge cases as first.
```javascript
Assertion.add('asset', function() {
this.params = { operator: 'to be asset' };
this.obj.should.have.property('id').which.is.a.Number();
this.obj.should.have.property('path');
})
//then
> ({ id: '10' }).should.be.an.asset();
AssertionError: expected { id: '10' } to be asset
expected '10' to be a number
> ({ id: 10 }).should.be.an.asset();
AssertionError: expected { id: 10 } to be asset
expected { id: 10 } to have property path
```
## Additional projects
* [`should-sinon`](https://github.com/shouldjs/sinon) - adds additional assertions for sinon.js
* [`should-immutable`](https://github.com/shouldjs/should-immutable) - extends different parts of should.js to make immutable.js first-class citizen in should.js
* [`should-http`](https://github.com/shouldjs/http) - adds small assertions for assertion on http responses for node only
* [`should-jq`](https://github.com/shouldjs/jq) - assertions for jq (need maintainer)
* [`karma-should`](https://github.com/seegno/karma-should) - make more or less easy to work karma with should.js
* [`should-spies`](https://github.com/shouldjs/spies) - small and dirty simple zero dependencies spies
## Contributions
[Actual list of contributors](https://github.com/visionmedia/should.js/graphs/contributors) if you want to show it your friends.
To run the tests for _should_ simply run:
$ npm test
See also [CONTRIBUTING](./CONTRIBUTING.md).
## OMG IT EXTENDS OBJECT???!?!@
Yes, 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.
Also it is possible use it without extension. Just use `require('should/as-function')` everywhere.
## License
MIT. See LICENSE for details.
Generated Vendored Executable
+2935
View File
File diff suppressed because it is too large Load Diff
Generated Vendored Executable
+2962
View File
File diff suppressed because it is too large Load Diff
Generated Vendored Executable
+2958
View File
File diff suppressed because it is too large Load Diff
Generated Vendored Executable
+51
View File
@@ -0,0 +1,51 @@
{
"name": "should",
"description": "test framework agnostic BDD-style assertions",
"version": "13.2.3",
"author": "TJ Holowaychuk <tj@vision-media.ca>, Denis Bardadym <bardadymchik@gmail.com>",
"typings": "./should.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/shouldjs/should.js.git"
},
"homepage": "https://github.com/shouldjs/should.js",
"scripts": {
"build:cjs": "rollup --output.format=cjs --output.file=cjs/should.js lib/index.js",
"build:es6": "rollup --output.format=es --output.file=es6/should.js lib/index.js",
"build": "npm run build:cjs && npm run build:es6",
"prepare": "npm run build && npm run build:umd && npm run build:cjs:as-function",
"pretest": "npm run build",
"build:cjs:as-function":
"rollup --input ./lib/should.js --output.format=cjs --output.file ./as-function.js",
"test":
"mocha -R mocha-better-spec-reporter --require ./cjs/should --color --check-leaks ./test/*.test.js ./test/**/*.test.js",
"zuul": "zuul -- ./test/**/*.test.js ./test/*.test.js",
"build:umd":
"rollup -c rollup.config.js --input ./lib/umd.js --output.format=iife --output.file ./should.js"
},
"devDependencies": {
"bluebird": "^3.5.1",
"eslint": "^3.19.0",
"eslint-config-shouldjs": "^1.0.0",
"mocha": "^4.0.1",
"mocha-better-spec-reporter": "latest",
"prettier": "^1.7.4",
"rollup": "^0.53.0",
"rollup-plugin-node-resolve": "^3.0.0",
"tslint": "^5.8.0",
"typescript": "^2.5.3",
"zuul": "latest"
},
"keywords": ["test", "bdd", "assert", "should"],
"main": "./cjs/should.js",
"module": "./es6/should.js",
"license": "MIT",
"dependencies": {
"should-equal": "^2.0.0",
"should-format": "^3.0.3",
"should-type": "^1.4.0",
"should-type-adaptors": "^1.0.1",
"should-util": "^1.0.0"
},
"files": ["cjs/*", "es6/*", "as-function.js", "should.js", "LICENSE", "*.md", "should.d.ts"]
}
Generated Vendored Executable
+243
View File
@@ -0,0 +1,243 @@
// Type definitions for should.js
declare function should(obj: any): should.Assertion;
// node assert methods
/*interface NodeAssert {
fail(actual: any, expected: any, message?: string, operator?: string): void;
ok(value: any, message?: string): void;
equal(actual: any, expected: any, message?: string): void;
notEqual(actual: any, expected: any, message?: string): void;
deepEqual(actual: any, expected: any, message?: string): void;
notDeepEqual(actual: any, expected: any, message?: string): void;
strictEqual(actual: any, expected: any, message?: string): void;
notStrictEqual(actual: any, expected: any, message?: string): void;
throws(block: Function, message?: string): void;
throws(block: Function, error: Function, message?: string): void;
throws(block: Function, error: RegExp, message?: string): void;
throws(block: Function, error: (err: any) => boolean, message?: string): void;
doesNotThrow(block: Function, message?: string): void;
doesNotThrow(block: Function, error: Function, message?: string): void;
doesNotThrow(block: Function, error: RegExp, message?: string): void;
doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void;
ifError(value: any): void;
}
interface should extends NodeAssert, ShouldAssertExt {
not: ShouldAssertExt;
}*/
declare namespace should {
interface ShouldAssertExt {
exist(obj: any, msg?: string): void;
exists(obj: any, msg?: string): void;
}
function fail(actual: any, expected: any, message?: string, operator?: string): void;
function ok(value: any, message?: string): void;
function equal(actual: any, expected: any, message?: string): void;
function notEqual(actual: any, expected: any, message?: string): void;
function deepEqual(actual: any, expected: any, message?: string): void;
function notDeepEqual(actual: any, expected: any, message?: string): void;
function strictEqual(actual: any, expected: any, message?: string): void;
function notStrictEqual(actual: any, expected: any, message?: string): void;
function throws(block: Function, message?: string): void;
function throws(block: Function, error: Function, message?: string): void;
function throws(block: Function, error: RegExp, message?: string): void;
function throws(block: Function, error: (err: any) => boolean, message?: string): void;
function doesNotThrow(block: Function, message?: string): void;
function doesNotThrow(block: Function, error: Function, message?: string): void;
function doesNotThrow(block: Function, error: RegExp, message?: string): void;
function doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void;
function ifError(value: any): void;
function exist(obj: any, msg?: string): void;
function exists(obj: any, msg?: string): void;
const not: ShouldAssertExt;
interface Assertion {
assert(expr: boolean): this;
fail(): this;
not: this;
any: this;
only: this;
// bool
true(message?: string): this;
True(message?: string): this;
false(message?: string): this;
False(message?: string): this;
ok(): this;
//chain
an: this;
of: this;
a: this;
and: this;
be: this;
been: this;
has: this;
have: this;
with: this;
is: this;
which: this;
the: this;
it: this;
//contain
containEql(obj: any): this;
containDeepOrdered(obj: any): this;
containDeep(obj: any): this;
// eql
eql(obj: any, description?: string): this;
eqls(obj: any, description?: string): this;
deepEqual(obj: any, description?: string): this;
equal(obj: any, description?: string): this;
equals(obj: any, description?: string): this;
exactly(obj: any, description?: string): this;
equalOneOf(...objs: any[]): this;
equalOneOf(obj: any[]): this;
oneOf(...objs: any[]): this;
oneOf(obj: any[]): this;
//error
throw(): this;
throw(msg: RegExp | string | Function, properties?: {}): this;
throw(properties: {}): this;
//TODO how to express generators???
throwError(): this;
throwError(msg: RegExp | string | Function, properties?: {}): this;
throwError(properties: {}): this;
// match
match(
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
description?: string
): this;
matchEach(
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
description?: string
): this;
matchEvery(
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
description?: string
): this;
matchAny(
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
description?: string
): this;
matchSome(
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
description?: string
): this;
//number
NaN(): this;
Infinity(): this;
within(start: number, finish: number, description?: string): this;
approximately(value: number, delta: number, description?: string): this;
above(value: number, description?: string): this;
greaterThan(value: number, description?: string): this;
below(value: number, description?: string): this;
lessThan(value: number, description?: string): this;
aboveOrEqual(value: number, description?: string): this;
greaterThanOrEqual(value: number, description?: string): this;
belowOrEqual(value: number, description?: string): this;
lessThanOrEqual(value: number, description?: string): this;
//promise
Promise(): this;
fulfilled(): Promise<any>;
resolved(): Promise<any>;
rejected(): Promise<any>;
fulfilledWith(obj: any): Promise<any>;
resolvedWith(obj: any): Promise<any>;
rejectedWith(msg: RegExp | string | Error, properties?: {}): Promise<any>;
rejectedWith(properties: {}): Promise<any>;
finally: PromisedAssertion;
eventually: PromisedAssertion;
// property
propertyWithDescriptor(name: string, descriptor: {}): this;
property(name: string, value?: any): this;
properties(...names: string[]): this;
properties(names: string[]): this;
properties(props: {}): this;
length(value: number, description?: string): this;
lengthOf(value: number, description?: string): this;
ownProperty(name: string, description?: string): this;
hasOwnProperty(name: string, description?: string): this;
empty(): this;
keys(...keys: any[]): this;
key(key: any): this;
value(key: any, value: any): this;
size(value: number): this;
propertyByPath(...path: string[]): this;
propertyByPath(path: string[]): this;
//string
startWith(prefix: string, description?: string): this;
endWith(postfix: string, description?: string): this;
//type
Number(): this;
arguments(): this;
Arguments(): this;
type(typeName: string, description?: string): this;
instanceof(constructor: Function, description?: string): this;
instanceOf(constructor: Function, description?: string): this;
Function(): this;
Object(): this;
String(): this;
Array(): this;
Boolean(): this;
Error(): this;
Date(): this;
null(): this;
Null(): this;
class(className: string): this;
Class(className: string): this;
undefined(): this;
Undefined(): this;
iterable(): this;
iterator(): this;
generator(): this;
}
interface PromisedAssertion extends Assertion, PromiseLike<any> {}
}
declare global {
interface Object {
should: should.Assertion;
}
}
export as namespace should;
export = should;
Generated Vendored Executable
+4371
View File
File diff suppressed because it is too large Load Diff