$
This commit is contained in:
1
node_modules/chai/CODEOWNERS
generated
vendored
Normal file
1
node_modules/chai/CODEOWNERS
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* @chaijs/chai
|
58
node_modules/chai/CODE_OF_CONDUCT.md
generated
vendored
Normal file
58
node_modules/chai/CODE_OF_CONDUCT.md
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
# Contributor Code of Conduct
|
||||
|
||||
> Read in: [Español](http://contributor-covenant.org/version/1/3/0/es/) |
|
||||
[Français](http://contributor-covenant.org/version/1/3/0/fr/) |
|
||||
[Italiano](http://contributor-covenant.org/version/1/3/0/it/) |
|
||||
[Magyar](http://contributor-covenant.org/version/1/3/0/hu/) |
|
||||
[Polskie](http://contributor-covenant.org/version/1/3/0/pl/) |
|
||||
[Português](http://contributor-covenant.org/version/1/3/0/pt/) |
|
||||
[Português do Brasil](http://contributor-covenant.org/version/1/3/0/pt_br/)
|
||||
|
||||
As contributors and maintainers of this project, and in the interest of
|
||||
fostering an open and welcoming community, we pledge to respect all people who
|
||||
contribute through reporting issues, posting feature requests, updating
|
||||
documentation, submitting pull requests or patches, and other activities.
|
||||
|
||||
We are committed to making participation in this project a harassment-free
|
||||
experience for everyone, regardless of level of experience, gender, gender
|
||||
identity and expression, sexual orientation, disability, personal appearance,
|
||||
body size, race, ethnicity, age, religion, or nationality.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery
|
||||
* Personal attacks
|
||||
* Trolling or insulting/derogatory comments
|
||||
* Public or private harassment
|
||||
* Publishing other's private information, such as physical or electronic
|
||||
addresses, without explicit permission
|
||||
* Other unethical or unprofessional conduct
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
By adopting this Code of Conduct, project maintainers commit themselves to
|
||||
fairly and consistently applying these principles to every aspect of managing
|
||||
this project. Project maintainers who do not follow or enforce the Code of
|
||||
Conduct may be permanently removed from the project team.
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting a project maintainer at chaijs@keithcirkel.co.uk. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. Maintainers are
|
||||
obligated to maintain confidentiality with regard to the reporter of an
|
||||
incident.
|
||||
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 1.3.0, available at
|
||||
[http://contributor-covenant.org/version/1/3/0/][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/3/0/
|
218
node_modules/chai/CONTRIBUTING.md
generated
vendored
Normal file
218
node_modules/chai/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
# Chai Contribution Guidelines
|
||||
|
||||
We like to encourage you to contribute to the Chai.js repository. This should be as easy as possible for you but there are a few things to consider when contributing. The following guidelines for contribution should be followed if you want to submit a pull request or open an issue.
|
||||
|
||||
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
|
||||
|
||||
#### Table of Contents
|
||||
|
||||
- [TLDR;](#tldr)
|
||||
- [Contributing](#contributing)
|
||||
- [Bug Reports](#bugs)
|
||||
- [Feature Requests](#features)
|
||||
- [Pull Requests](#pull-requests)
|
||||
- [Releasing](#releasing)
|
||||
- [Support](#support)
|
||||
- [Resources](#resources)
|
||||
- [Core Contributors](#contributors)
|
||||
|
||||
<a name="tldr"></a>
|
||||
## TLDR;
|
||||
|
||||
- Creating an Issue or Pull Request requires a [GitHub](http://github.com) account.
|
||||
- Issue reports should be **clear**, **concise** and **reproducible**. Check to see if your issue has already been resolved in the [master]() branch or already reported in Chai's [GitHub Issue Tracker](https://github.com/chaijs/chai/issues).
|
||||
- Pull Requests must adhere to strict [coding style guidelines](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide).
|
||||
- In general, avoid submitting PRs for new Assertions without asking core contributors first. More than likely it would be better implemented as a plugin.
|
||||
- Additional support is available via the [Google Group](http://groups.google.com/group/chaijs) or on irc.freenode.net#chaijs.
|
||||
- **IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by the project.
|
||||
|
||||
|
||||
|
||||
<a name="contributing"></a>
|
||||
## Contributing
|
||||
|
||||
The issue tracker is the preferred channel for [bug reports](#bugs),
|
||||
[feature requests](#features) and [submitting pull
|
||||
requests](#pull-requests), but please respect the following restrictions:
|
||||
|
||||
* Please **do not** use the issue tracker for personal support requests (use
|
||||
[Google Group](https://groups.google.com/forum/#!forum/chaijs) or IRC).
|
||||
* Please **do not** derail or troll issues. Keep the discussion on topic and
|
||||
respect the opinions of others
|
||||
|
||||
<a name="bugs"></a>
|
||||
### Bug Reports
|
||||
|
||||
A bug is a **demonstrable problem** that is caused by the code in the repository.
|
||||
|
||||
Guidelines for bug reports:
|
||||
|
||||
1. **Use the GitHub issue search** — check if the issue has already been reported.
|
||||
2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or development branch in the repository.
|
||||
3. **Isolate the problem** — create a test case to demonstrate your issue. Provide either a repo, gist, or code sample to demonstrate you problem.
|
||||
|
||||
A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and/or Node.js versions experience the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
|
||||
|
||||
Example:
|
||||
|
||||
> Short and descriptive example bug report title
|
||||
>
|
||||
> A summary of the issue and the browser/OS environment in which it occurs. If suitable, include the steps required to reproduce the bug.
|
||||
>
|
||||
> 1. This is the first step
|
||||
> 2. This is the second step
|
||||
> 3. Further steps, etc.
|
||||
>
|
||||
> `<url>` - a link to the reduced test case OR
|
||||
> ```js
|
||||
> expect(a).to.equal('a');
|
||||
> // code sample
|
||||
> ```
|
||||
>
|
||||
> Any other information you want to share that is relevant to the issue being reported. This might include the lines of code that you have identified as causing the bug, and potential solutions (and your opinions on their merits).
|
||||
|
||||
<a name="features"></a>
|
||||
### Feature Requests
|
||||
|
||||
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
|
||||
|
||||
Furthermore, since Chai.js has a [robust plugin API](http://chaijs.com/guide/plugins/), we encourage you to publish **new Assertions** as plugins. If your feature is an enhancement to an **existing Assertion**, please propose your changes as an issue prior to opening a pull request. If the core Chai.js contributors feel your plugin would be better suited as a core assertion, they will invite you to open a PR in [chaijs/chai](https://github.com/chaijs/chai).
|
||||
|
||||
<a name="pull-requests"></a>
|
||||
### Pull Requests
|
||||
|
||||
- PRs for new core-assertions are advised against.
|
||||
- PRs for core-assertion bug fixes are always welcome.
|
||||
- PRs for enhancing the interfaces are always welcome.
|
||||
- PRs that increase test coverage are always welcome.
|
||||
- PRs are scrutinized for coding-style.
|
||||
|
||||
Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
|
||||
|
||||
**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
|
||||
|
||||
Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). Please review the [Chai.js Coding Style Guide](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide).
|
||||
|
||||
Follow this process if you'd like your work considered for inclusion in the project:
|
||||
|
||||
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, and configure the remotes:
|
||||
|
||||
```bash
|
||||
# Clone your fork of the repo into the current directory
|
||||
git clone https://github.com/<your-username>/<repo-name>
|
||||
# Navigate to the newly cloned directory
|
||||
cd <repo-name>
|
||||
# Assign the original repo to a remote called "upstream"
|
||||
git remote add upstream https://github.com/<upstream-owner>/<repo-name>
|
||||
```
|
||||
|
||||
2. If you cloned a while ago, get the latest changes from upstream:
|
||||
|
||||
```bash
|
||||
git checkout <dev-branch>
|
||||
git pull upstream <dev-branch>
|
||||
```
|
||||
|
||||
3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix:
|
||||
|
||||
```bash
|
||||
git checkout -b <topic-branch-name>
|
||||
```
|
||||
|
||||
4. Commit your changes in logical chunks. Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) feature to tidy up your commits before making them public.
|
||||
|
||||
5. Run you code to make sure it works. If you're still having problems please try to run `make clean` and then test your code again.
|
||||
|
||||
```bash
|
||||
npm test
|
||||
# when finished running tests...
|
||||
git checkout chai.js
|
||||
```
|
||||
|
||||
6. Locally merge (or rebase) the upstream development branch into your topic branch:
|
||||
|
||||
```bash
|
||||
git pull [--rebase] upstream <dev-branch>
|
||||
```
|
||||
|
||||
7. Push your topic branch up to your fork:
|
||||
|
||||
```bash
|
||||
git push origin <topic-branch-name>
|
||||
```
|
||||
|
||||
8. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description.
|
||||
|
||||
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by the project.
|
||||
|
||||
<a name="releasing"></a>
|
||||
## Releasing
|
||||
|
||||
Releases can be **prepared** by anyone with access to the code.
|
||||
|
||||
Simply run `make release-major`, `make release-minor`, or `make-release-patch`
|
||||
and it will automatically do the following:
|
||||
|
||||
- Build chai.js
|
||||
- Bump the version numbers across the project
|
||||
- Make a commit within git
|
||||
|
||||
All you need to do is push the commit up and make a pull request, one of the core contributors will merge it and publish a release.
|
||||
|
||||
### Publishing a Release
|
||||
|
||||
Anyone who is a core contributor (see the [Core Contributors Heading in the Readme](https://github.com/chaijs/chai#core-contributors)) can publish a release:
|
||||
|
||||
1. Go to the [Releases page on Github](https://github.com/chaijs/chai/releases)
|
||||
2. Hit "Draft a new release" (if you can't see this, you're not a core contributor!)
|
||||
3. Write human-friendly Release Notes based on changelog.
|
||||
- The release title is "x.x.x / YYYY-MM-DD" (where x.x.x is the version number)
|
||||
- If breaking changes, write migration tutorial(s) and reasoning.
|
||||
- Callouts for community contributions (PRs) with links to PR and contributing user.
|
||||
- Callouts for other fixes made by core contributors with links to issue.
|
||||
4. Hit "Save Draft" and get other core contributors to check your work, or alternatively hit "Publish release"
|
||||
5. That's it!
|
||||
|
||||
<a name="support"></a>
|
||||
## Support
|
||||
|
||||
<a name="resources"></a>
|
||||
### Resources
|
||||
|
||||
For most of the documentation you are going to want to visit [ChaiJS.com](http://chaijs.com).
|
||||
|
||||
- [Getting Started Guide](http://chaijs.com/guide/)
|
||||
- [API Reference](http://chaijs.com/api/)
|
||||
- [Plugins](http://chaijs.com/plugins/)
|
||||
|
||||
Alternatively, the [wiki](https://github.com/chaijs/chai/wiki) might be what you are looking for.
|
||||
|
||||
- [Chai Coding Style Guide](https://github.com/chaijs/chai/wiki/Chai-Coding-Style-Guide)
|
||||
- [Third-party Resources](https://github.com/chaijs/chai/wiki/Third-Party-Resources)
|
||||
|
||||
Or finally, you may find a core-contributor or like-minded developer in any of our support channels.
|
||||
|
||||
- IRC: irc.freenode.org #chaijs
|
||||
- [Mailing List / Google Group](https://groups.google.com/forum/#!forum/chaijs)
|
||||
|
||||
<a name="contributors"></a>
|
||||
### Core Contributors
|
||||
|
||||
Feel free to reach out to any of the core-contributors with you questions or concerns. We will do our best to respond in a timely manner.
|
||||
|
||||
- Jake Luer
|
||||
- GH: [@logicalparadox](https://github.com/logicalparadox)
|
||||
- TW: [@jakeluer](http://twitter.com/jakeluer)
|
||||
- IRC: logicalparadox
|
||||
- Veselin Todorov
|
||||
- GH: [@vesln](https://github.com/vesln/)
|
||||
- TW: [@vesln](http://twitter.com/vesln)
|
||||
- IRC: vesln
|
||||
- Keith Cirkel
|
||||
- GH: [@keithamus](https://github.com/keithamus)
|
||||
- TW: [@keithamus](http://twitter.com/keithamus)
|
||||
- IRC: keithamus
|
||||
- Lucas Fernandes da Costa
|
||||
- GH: [@lucasfcosta](https://github.com/lucasfcosta)
|
||||
- TW: [@lfernandescosta](https://twitter.com/lfernandescosta)
|
||||
- IRC: lucasfcosta
|
1059
node_modules/chai/History.md
generated
vendored
Normal file
1059
node_modules/chai/History.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
node_modules/chai/LICENSE
generated
vendored
Normal file
21
node_modules/chai/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Chai.js Assertion Library
|
||||
|
||||
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.
|
212
node_modules/chai/README.md
generated
vendored
Normal file
212
node_modules/chai/README.md
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
<h1 align=center>
|
||||
<a href="http://chaijs.com" title="Chai Documentation">
|
||||
<img alt="ChaiJS" src="http://chaijs.com/img/chai-logo.png">
|
||||
</a>
|
||||
<br>
|
||||
chai
|
||||
</h1>
|
||||
|
||||
<p align=center>
|
||||
Chai is a BDD / TDD assertion library for <a href="http://nodejs.org">node</a> and the browser that can be delightfully paired with any javascript testing framework.
|
||||
</p>
|
||||
|
||||
<p align=center>
|
||||
<a href="./LICENSE">
|
||||
<img
|
||||
alt="license:mit"
|
||||
src="https://img.shields.io/badge/license-mit-green.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/chaijs/chai/releases">
|
||||
<img
|
||||
alt="tag:?"
|
||||
src="https://img.shields.io/github/tag/chaijs/chai.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://www.npmjs.com/package/chai">
|
||||
<img
|
||||
alt="node:?"
|
||||
src="https://img.shields.io/badge/node-%3E=4.0-blue.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<br/>
|
||||
<a href="https://saucelabs.com/u/chaijs">
|
||||
<img
|
||||
alt="Selenium Test Status"
|
||||
src="https://saucelabs.com/browser-matrix/chaijs.svg"
|
||||
/>
|
||||
</a>
|
||||
<br/>
|
||||
<a href="https://www.npmjs.com/packages/chai">
|
||||
<img
|
||||
alt="downloads:?"
|
||||
src="https://img.shields.io/npm/dm/chai.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://travis-ci.org/chaijs/chai">
|
||||
<img
|
||||
alt="build:?"
|
||||
src="https://img.shields.io/travis/chaijs/chai/master.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/chaijs/chai">
|
||||
<img
|
||||
alt="coverage:?"
|
||||
src="https://img.shields.io/codecov/c/github/chaijs/chai.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="">
|
||||
<img
|
||||
alt="devDependencies:?"
|
||||
src="https://img.shields.io/david/chaijs/chai.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<br/>
|
||||
<a href="https://chai-slack.herokuapp.com/">
|
||||
<img
|
||||
alt="Join the Slack chat"
|
||||
src="https://img.shields.io/badge/slack-join%20chat-E2206F.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://gitter.im/chaijs/chai">
|
||||
<img
|
||||
alt="Join the Gitter chat"
|
||||
src="https://img.shields.io/badge/gitter-join%20chat-D0104D.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://opencollective.com/chaijs">
|
||||
<img
|
||||
alt="OpenCollective Backers"
|
||||
src="https://opencollective.com/chaijs/backers/badge.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
For more information or to download plugins, view the [documentation](http://chaijs.com).
|
||||
|
||||
## What is Chai?
|
||||
|
||||
Chai is an _assertion library_, similar to Node's built-in `assert`. It makes testing much easier by giving you lots of assertions you can run against your code.
|
||||
|
||||
## Installation
|
||||
|
||||
### Node.js
|
||||
|
||||
`chai` is available on [npm](http://npmjs.org). To install it, type:
|
||||
|
||||
$ npm install --save-dev chai
|
||||
|
||||
### Browsers
|
||||
|
||||
You can also use it within the browser; install via npm and use the `chai.js` file found within the download. For example:
|
||||
|
||||
```html
|
||||
<script src="./node_modules/chai/chai.js"></script>
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Import the library in your code, and then pick one of the styles you'd like to use - either `assert`, `expect` or `should`:
|
||||
|
||||
```js
|
||||
var chai = require('chai');
|
||||
var assert = chai.assert; // Using Assert style
|
||||
var expect = chai.expect; // Using Expect style
|
||||
var should = chai.should(); // Using Should style
|
||||
```
|
||||
|
||||
### Pre-Native Modules Usage (_registers the chai testing style globally_)
|
||||
|
||||
```js
|
||||
require('chai/register-assert'); // Using Assert style
|
||||
require('chai/register-expect'); // Using Expect style
|
||||
require('chai/register-should'); // Using Should style
|
||||
```
|
||||
|
||||
### Pre-Native Modules Usage (_as local variables_)
|
||||
|
||||
```js
|
||||
const { assert } = require('chai'); // Using Assert style
|
||||
const { expect } = require('chai'); // Using Expect style
|
||||
const { should } = require('chai'); // Using Should style
|
||||
should(); // Modifies `Object.prototype`
|
||||
|
||||
const { expect, use } = require('chai'); // Creates local variables `expect` and `use`; useful for plugin use
|
||||
```
|
||||
|
||||
### Native Modules Usage (_registers the chai testing style globally_)
|
||||
|
||||
```js
|
||||
import 'chai/register-assert'; // Using Assert style
|
||||
import 'chai/register-expect'; // Using Expect style
|
||||
import 'chai/register-should'; // Using Should style
|
||||
```
|
||||
|
||||
### Native Modules Usage (_local import only_)
|
||||
|
||||
```js
|
||||
import { assert } from 'chai'; // Using Assert style
|
||||
import { expect } from 'chai'; // Using Expect style
|
||||
import { should } from 'chai'; // Using Should style
|
||||
should(); // Modifies `Object.prototype`
|
||||
```
|
||||
|
||||
### Usage with Mocha
|
||||
|
||||
```bash
|
||||
mocha spec.js -r chai/register-assert # Using Assert style
|
||||
mocha spec.js -r chai/register-expect # Using Expect style
|
||||
mocha spec.js -r chai/register-should # Using Should style
|
||||
```
|
||||
|
||||
[Read more about these styles in our docs](http://chaijs.com/guide/styles/).
|
||||
|
||||
## Plugins
|
||||
|
||||
Chai offers a robust Plugin architecture for extending Chai's assertions and interfaces.
|
||||
|
||||
- Need a plugin? View the [official plugin list](http://chaijs.com/plugins).
|
||||
- Want to build a plugin? Read the [plugin api documentation](http://chaijs.com/guide/plugins/).
|
||||
- Have a plugin and want it listed? Simply add the following keywords to your package.json:
|
||||
- `chai-plugin`
|
||||
- `browser` if your plugin works in the browser as well as Node.js
|
||||
- `browser-only` if your plugin does not work with Node.js
|
||||
|
||||
### Related Projects
|
||||
|
||||
- [chaijs / chai-docs](https://github.com/chaijs/chai-docs): The chaijs.com website source code.
|
||||
- [chaijs / assertion-error](https://github.com/chaijs/assertion-error): Custom `Error` constructor thrown upon an assertion failing.
|
||||
- [chaijs / deep-eql](https://github.com/chaijs/deep-eql): Improved deep equality testing for Node.js and the browser.
|
||||
- [chaijs / type-detect](https://github.com/chaijs/type-detect): Improved typeof detection for Node.js and the browser.
|
||||
- [chaijs / check-error](https://github.com/chaijs/check-error): Error comparison and information related utility for Node.js and the browser.
|
||||
- [chaijs / loupe](https://github.com/chaijs/loupe): Inspect utility for Node.js and browsers.
|
||||
- [chaijs / pathval](https://github.com/chaijs/pathval): Object value retrieval given a string path.
|
||||
- [chaijs / get-func-name](https://github.com/chaijs/get-func-name): Utility for getting a function's name for node and the browser.
|
||||
|
||||
### Contributing
|
||||
|
||||
Thank you very much for considering to contribute!
|
||||
|
||||
Please make sure you follow our [Code Of Conduct](https://github.com/chaijs/chai/blob/master/CODE_OF_CONDUCT.md) and we also strongly recommend reading our [Contributing Guide](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md).
|
||||
|
||||
Here are a few issues other contributors frequently ran into when opening pull requests:
|
||||
|
||||
- Please do not commit changes to the `chai.js` build. We do it once per release.
|
||||
- Before pushing your commits, please make sure you [rebase](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md#pull-requests) them.
|
||||
|
||||
### Contributors
|
||||
|
||||
Please see the full
|
||||
[Contributors Graph](https://github.com/chaijs/chai/graphs/contributors) for our
|
||||
list of contributors.
|
||||
|
||||
### Core Contributors
|
||||
|
||||
Feel free to reach out to any of the core contributors with your questions or
|
||||
concerns. We will do our best to respond in a timely manner.
|
||||
|
||||
[](https://github.com/logicalparadox)
|
||||
[](https://github.com/vesln)
|
||||
[](https://github.com/keithamus)
|
||||
[](https://github.com/lucasfcosta)
|
||||
[](https://github.com/meeber)
|
737
node_modules/chai/ReleaseNotes.md
generated
vendored
Normal file
737
node_modules/chai/ReleaseNotes.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
26
node_modules/chai/bower.json
generated
vendored
Normal file
26
node_modules/chai/bower.json
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "chai",
|
||||
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"test",
|
||||
"assertion",
|
||||
"assert",
|
||||
"testing",
|
||||
"chai"
|
||||
],
|
||||
"main": "chai.js",
|
||||
"ignore": [
|
||||
"build",
|
||||
"components",
|
||||
"lib",
|
||||
"node_modules",
|
||||
"support",
|
||||
"test",
|
||||
"index.js",
|
||||
"Makefile",
|
||||
".*"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {}
|
||||
}
|
11464
node_modules/chai/chai.js
generated
vendored
Normal file
11464
node_modules/chai/chai.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/chai/index.js
generated
vendored
Normal file
1
node_modules/chai/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./lib/chai');
|
14
node_modules/chai/index.mjs
generated
vendored
Normal file
14
node_modules/chai/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import chai from './index.js';
|
||||
|
||||
export const expect = chai.expect;
|
||||
export const version = chai.version;
|
||||
export const Assertion = chai.Assertion;
|
||||
export const AssertionError = chai.AssertionError;
|
||||
export const util = chai.util;
|
||||
export const config = chai.config;
|
||||
export const use = chai.use;
|
||||
export const should = chai.should;
|
||||
export const assert = chai.assert;
|
||||
export const core = chai.core;
|
||||
|
||||
export default chai;
|
34
node_modules/chai/karma.conf.js
generated
vendored
Normal file
34
node_modules/chai/karma.conf.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
frameworks: [ 'mocha' ]
|
||||
, files: [
|
||||
'chai.js'
|
||||
, 'test/bootstrap/index.js'
|
||||
, 'test/*.js'
|
||||
]
|
||||
, reporters: [ 'progress' ]
|
||||
, colors: true
|
||||
, logLevel: config.LOG_INFO
|
||||
, autoWatch: false
|
||||
, browsers: [ 'HeadlessChrome' ]
|
||||
, customLaunchers: {
|
||||
HeadlessChrome: {
|
||||
base: 'ChromeHeadless'
|
||||
, flags: [ '--no-sandbox',]
|
||||
, }
|
||||
, }
|
||||
, browserDisconnectTimeout: 10000
|
||||
, browserDisconnectTolerance: 2
|
||||
, browserNoActivityTimeout: 20000
|
||||
, singleRun: true
|
||||
});
|
||||
|
||||
switch (process.env.CHAI_TEST_ENV) {
|
||||
case 'sauce':
|
||||
require('./karma.sauce')(config);
|
||||
break;
|
||||
default:
|
||||
// ...
|
||||
break;
|
||||
};
|
||||
};
|
41
node_modules/chai/karma.sauce.js
generated
vendored
Normal file
41
node_modules/chai/karma.sauce.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
var version = require('./package.json').version;
|
||||
var ts = new Date().getTime();
|
||||
|
||||
module.exports = function(config) {
|
||||
var auth;
|
||||
|
||||
try {
|
||||
auth = require('./test/auth/index');
|
||||
} catch(ex) {
|
||||
auth = {};
|
||||
auth.SAUCE_USERNAME = process.env.SAUCE_USERNAME || null;
|
||||
auth.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY || null;
|
||||
}
|
||||
|
||||
if (!auth.SAUCE_USERNAME || !auth.SAUCE_ACCESS_KEY) return;
|
||||
if (process.env.SKIP_SAUCE) return;
|
||||
|
||||
var branch = process.env.TRAVIS_BRANCH || 'local'
|
||||
var browserConfig = require('./sauce.browsers');
|
||||
var browsers = Object.keys(browserConfig);
|
||||
var tags = [ 'chaijs_' + version, auth.SAUCE_USERNAME + '@' + branch ];
|
||||
var tunnel = process.env.TRAVIS_JOB_NUMBER || ts;
|
||||
|
||||
if (process.env.TRAVIS_JOB_NUMBER) {
|
||||
tags.push('travis@' + process.env.TRAVIS_JOB_NUMBER);
|
||||
}
|
||||
|
||||
config.browsers = config.browsers.concat(browsers);
|
||||
Object.assign(config.customLaunchers, browserConfig);
|
||||
config.reporters.push('saucelabs');
|
||||
config.captureTimeout = 300000;
|
||||
|
||||
config.sauceLabs = {
|
||||
username: auth.SAUCE_USERNAME
|
||||
, accessKey: auth.SAUCE_ACCESS_KEY
|
||||
, startConnect: ('TRAVIS' in process.env) === false
|
||||
, tags: tags
|
||||
, testName: 'ChaiJS'
|
||||
, tunnelIdentifier: tunnel
|
||||
};
|
||||
};
|
92
node_modules/chai/lib/chai.js
generated
vendored
Normal file
92
node_modules/chai/lib/chai.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var used = [];
|
||||
|
||||
/*!
|
||||
* Chai version
|
||||
*/
|
||||
|
||||
exports.version = '4.3.3';
|
||||
|
||||
/*!
|
||||
* Assertion Error
|
||||
*/
|
||||
|
||||
exports.AssertionError = require('assertion-error');
|
||||
|
||||
/*!
|
||||
* Utils for plugins (not exported)
|
||||
*/
|
||||
|
||||
var util = require('./chai/utils');
|
||||
|
||||
/**
|
||||
* # .use(function)
|
||||
*
|
||||
* Provides a way to extend the internals of Chai.
|
||||
*
|
||||
* @param {Function}
|
||||
* @returns {this} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.use = function (fn) {
|
||||
if (!~used.indexOf(fn)) {
|
||||
fn(exports, util);
|
||||
used.push(fn);
|
||||
}
|
||||
|
||||
return exports;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Utility Functions
|
||||
*/
|
||||
|
||||
exports.util = util;
|
||||
|
||||
/*!
|
||||
* Configuration
|
||||
*/
|
||||
|
||||
var config = require('./chai/config');
|
||||
exports.config = config;
|
||||
|
||||
/*!
|
||||
* Primary `Assertion` prototype
|
||||
*/
|
||||
|
||||
var assertion = require('./chai/assertion');
|
||||
exports.use(assertion);
|
||||
|
||||
/*!
|
||||
* Core Assertions
|
||||
*/
|
||||
|
||||
var core = require('./chai/core/assertions');
|
||||
exports.use(core);
|
||||
|
||||
/*!
|
||||
* Expect interface
|
||||
*/
|
||||
|
||||
var expect = require('./chai/interface/expect');
|
||||
exports.use(expect);
|
||||
|
||||
/*!
|
||||
* Should interface
|
||||
*/
|
||||
|
||||
var should = require('./chai/interface/should');
|
||||
exports.use(should);
|
||||
|
||||
/*!
|
||||
* Assert interface
|
||||
*/
|
||||
|
||||
var assert = require('./chai/interface/assert');
|
||||
exports.use(assert);
|
175
node_modules/chai/lib/chai/assertion.js
generated
vendored
Normal file
175
node_modules/chai/lib/chai/assertion.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
/*!
|
||||
* chai
|
||||
* http://chaijs.com
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var config = require('./config');
|
||||
|
||||
module.exports = function (_chai, util) {
|
||||
/*!
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var AssertionError = _chai.AssertionError
|
||||
, flag = util.flag;
|
||||
|
||||
/*!
|
||||
* Module export.
|
||||
*/
|
||||
|
||||
_chai.Assertion = Assertion;
|
||||
|
||||
/*!
|
||||
* Assertion Constructor
|
||||
*
|
||||
* Creates object for chaining.
|
||||
*
|
||||
* `Assertion` objects contain metadata in the form of flags. Three flags can
|
||||
* be assigned during instantiation by passing arguments to this constructor:
|
||||
*
|
||||
* - `object`: This flag contains the target of the assertion. For example, in
|
||||
* the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
|
||||
* contain `numKittens` so that the `equal` assertion can reference it when
|
||||
* needed.
|
||||
*
|
||||
* - `message`: This flag contains an optional custom error message to be
|
||||
* prepended to the error message that's generated by the assertion when it
|
||||
* fails.
|
||||
*
|
||||
* - `ssfi`: This flag stands for "start stack function indicator". It
|
||||
* contains a function reference that serves as the starting point for
|
||||
* removing frames from the stack trace of the error that's created by the
|
||||
* assertion when it fails. The goal is to provide a cleaner stack trace to
|
||||
* end users by removing Chai's internal functions. Note that it only works
|
||||
* in environments that support `Error.captureStackTrace`, and only when
|
||||
* `Chai.config.includeStack` hasn't been set to `false`.
|
||||
*
|
||||
* - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
|
||||
* should retain its current value, even as assertions are chained off of
|
||||
* this object. This is usually set to `true` when creating a new assertion
|
||||
* from within another assertion. It's also temporarily set to `true` before
|
||||
* an overwritten assertion gets called by the overwriting assertion.
|
||||
*
|
||||
* @param {Mixed} obj target of the assertion
|
||||
* @param {String} msg (optional) custom error message
|
||||
* @param {Function} ssfi (optional) starting point for removing stack frames
|
||||
* @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Assertion (obj, msg, ssfi, lockSsfi) {
|
||||
flag(this, 'ssfi', ssfi || Assertion);
|
||||
flag(this, 'lockSsfi', lockSsfi);
|
||||
flag(this, 'object', obj);
|
||||
flag(this, 'message', msg);
|
||||
|
||||
return util.proxify(this);
|
||||
}
|
||||
|
||||
Object.defineProperty(Assertion, 'includeStack', {
|
||||
get: function() {
|
||||
console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
|
||||
return config.includeStack;
|
||||
},
|
||||
set: function(value) {
|
||||
console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
|
||||
config.includeStack = value;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(Assertion, 'showDiff', {
|
||||
get: function() {
|
||||
console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
|
||||
return config.showDiff;
|
||||
},
|
||||
set: function(value) {
|
||||
console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
|
||||
config.showDiff = value;
|
||||
}
|
||||
});
|
||||
|
||||
Assertion.addProperty = function (name, fn) {
|
||||
util.addProperty(this.prototype, name, fn);
|
||||
};
|
||||
|
||||
Assertion.addMethod = function (name, fn) {
|
||||
util.addMethod(this.prototype, name, fn);
|
||||
};
|
||||
|
||||
Assertion.addChainableMethod = function (name, fn, chainingBehavior) {
|
||||
util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
||||
};
|
||||
|
||||
Assertion.overwriteProperty = function (name, fn) {
|
||||
util.overwriteProperty(this.prototype, name, fn);
|
||||
};
|
||||
|
||||
Assertion.overwriteMethod = function (name, fn) {
|
||||
util.overwriteMethod(this.prototype, name, fn);
|
||||
};
|
||||
|
||||
Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
|
||||
util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .assert(expression, message, negateMessage, expected, actual, showDiff)
|
||||
*
|
||||
* Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
|
||||
*
|
||||
* @name assert
|
||||
* @param {Philosophical} expression to be tested
|
||||
* @param {String|Function} message or function that returns message to display if expression fails
|
||||
* @param {String|Function} negatedMessage or function that returns negatedMessage to display if negated expression fails
|
||||
* @param {Mixed} expected value (remember to check for negation)
|
||||
* @param {Mixed} actual (optional) will default to `this.obj`
|
||||
* @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
|
||||
var ok = util.test(this, arguments);
|
||||
if (false !== showDiff) showDiff = true;
|
||||
if (undefined === expected && undefined === _actual) showDiff = false;
|
||||
if (true !== config.showDiff) showDiff = false;
|
||||
|
||||
if (!ok) {
|
||||
msg = util.getMessage(this, arguments);
|
||||
var actual = util.getActual(this, arguments);
|
||||
var assertionErrorObjectProperties = {
|
||||
actual: actual
|
||||
, expected: expected
|
||||
, showDiff: showDiff
|
||||
};
|
||||
|
||||
var operator = util.getOperator(this, arguments);
|
||||
if (operator) {
|
||||
assertionErrorObjectProperties.operator = operator;
|
||||
}
|
||||
|
||||
throw new AssertionError(
|
||||
msg,
|
||||
assertionErrorObjectProperties,
|
||||
(config.includeStack) ? this.assert : flag(this, 'ssfi'));
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* ### ._obj
|
||||
*
|
||||
* Quick reference to stored `actual` value for plugin developers.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Object.defineProperty(Assertion.prototype, '_obj',
|
||||
{ get: function () {
|
||||
return flag(this, 'object');
|
||||
}
|
||||
, set: function (val) {
|
||||
flag(this, 'object', val);
|
||||
}
|
||||
});
|
||||
};
|
94
node_modules/chai/lib/chai/config.js
generated
vendored
Normal file
94
node_modules/chai/lib/chai/config.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* ### config.includeStack
|
||||
*
|
||||
* User configurable property, influences whether stack trace
|
||||
* is included in Assertion error message. Default of false
|
||||
* suppresses stack trace in the error message.
|
||||
*
|
||||
* chai.config.includeStack = true; // enable stack on error
|
||||
*
|
||||
* @param {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
includeStack: false,
|
||||
|
||||
/**
|
||||
* ### config.showDiff
|
||||
*
|
||||
* User configurable property, influences whether or not
|
||||
* the `showDiff` flag should be included in the thrown
|
||||
* AssertionErrors. `false` will always be `false`; `true`
|
||||
* will be true when the assertion has requested a diff
|
||||
* be shown.
|
||||
*
|
||||
* @param {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
showDiff: true,
|
||||
|
||||
/**
|
||||
* ### config.truncateThreshold
|
||||
*
|
||||
* User configurable property, sets length threshold for actual and
|
||||
* expected values in assertion errors. If this threshold is exceeded, for
|
||||
* example for large data structures, the value is replaced with something
|
||||
* like `[ Array(3) ]` or `{ Object (prop1, prop2) }`.
|
||||
*
|
||||
* Set it to zero if you want to disable truncating altogether.
|
||||
*
|
||||
* This is especially userful when doing assertions on arrays: having this
|
||||
* set to a reasonable large value makes the failure messages readily
|
||||
* inspectable.
|
||||
*
|
||||
* chai.config.truncateThreshold = 0; // disable truncating
|
||||
*
|
||||
* @param {Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
truncateThreshold: 40,
|
||||
|
||||
/**
|
||||
* ### config.useProxy
|
||||
*
|
||||
* User configurable property, defines if chai will use a Proxy to throw
|
||||
* an error when a non-existent property is read, which protects users
|
||||
* from typos when using property-based assertions.
|
||||
*
|
||||
* Set it to false if you want to disable this feature.
|
||||
*
|
||||
* chai.config.useProxy = false; // disable use of Proxy
|
||||
*
|
||||
* This feature is automatically disabled regardless of this config value
|
||||
* in environments that don't support proxies.
|
||||
*
|
||||
* @param {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
useProxy: true,
|
||||
|
||||
/**
|
||||
* ### config.proxyExcludedKeys
|
||||
*
|
||||
* User configurable property, defines which properties should be ignored
|
||||
* instead of throwing an error if they do not exist on the assertion.
|
||||
* This is only applied if the environment Chai is running in supports proxies and
|
||||
* if the `useProxy` configuration setting is enabled.
|
||||
* By default, `then` and `inspect` will not throw an error if they do not exist on the
|
||||
* assertion object because the `.inspect` property is read by `util.inspect` (for example, when
|
||||
* using `console.log` on the assertion object) and `.then` is necessary for promise type-checking.
|
||||
*
|
||||
* // By default these keys will not throw an error if they do not exist on the assertion object
|
||||
* chai.config.proxyExcludedKeys = ['then', 'inspect'];
|
||||
*
|
||||
* @param {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON']
|
||||
};
|
3853
node_modules/chai/lib/chai/core/assertions.js
generated
vendored
Normal file
3853
node_modules/chai/lib/chai/core/assertions.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3113
node_modules/chai/lib/chai/interface/assert.js
generated
vendored
Normal file
3113
node_modules/chai/lib/chai/interface/assert.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
47
node_modules/chai/lib/chai/interface/expect.js
generated
vendored
Normal file
47
node_modules/chai/lib/chai/interface/expect.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
module.exports = function (chai, util) {
|
||||
chai.expect = function (val, message) {
|
||||
return new chai.Assertion(val, message);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .fail([message])
|
||||
* ### .fail(actual, expected, [message], [operator])
|
||||
*
|
||||
* Throw a failure.
|
||||
*
|
||||
* expect.fail();
|
||||
* expect.fail("custom error message");
|
||||
* expect.fail(1, 2);
|
||||
* expect.fail(1, 2, "custom error message");
|
||||
* expect.fail(1, 2, "custom error message", ">");
|
||||
* expect.fail(1, 2, undefined, ">");
|
||||
*
|
||||
* @name fail
|
||||
* @param {Mixed} actual
|
||||
* @param {Mixed} expected
|
||||
* @param {String} message
|
||||
* @param {String} operator
|
||||
* @namespace BDD
|
||||
* @api public
|
||||
*/
|
||||
|
||||
chai.expect.fail = function (actual, expected, message, operator) {
|
||||
if (arguments.length < 2) {
|
||||
message = actual;
|
||||
actual = undefined;
|
||||
}
|
||||
|
||||
message = message || 'expect.fail()';
|
||||
throw new chai.AssertionError(message, {
|
||||
actual: actual
|
||||
, expected: expected
|
||||
, operator: operator
|
||||
}, chai.expect.fail);
|
||||
};
|
||||
};
|
219
node_modules/chai/lib/chai/interface/should.js
generated
vendored
Normal file
219
node_modules/chai/lib/chai/interface/should.js
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
module.exports = function (chai, util) {
|
||||
var Assertion = chai.Assertion;
|
||||
|
||||
function loadShould () {
|
||||
// explicitly define this method as function as to have it's name to include as `ssfi`
|
||||
function shouldGetter() {
|
||||
if (this instanceof String
|
||||
|| this instanceof Number
|
||||
|| this instanceof Boolean
|
||||
|| typeof Symbol === 'function' && this instanceof Symbol
|
||||
|| typeof BigInt === 'function' && this instanceof BigInt) {
|
||||
return new Assertion(this.valueOf(), null, shouldGetter);
|
||||
}
|
||||
return new Assertion(this, null, shouldGetter);
|
||||
}
|
||||
function shouldSetter(value) {
|
||||
// See https://github.com/chaijs/chai/issues/86: this makes
|
||||
// `whatever.should = someValue` actually set `someValue`, which is
|
||||
// especially useful for `global.should = require('chai').should()`.
|
||||
//
|
||||
// Note that we have to use [[DefineProperty]] instead of [[Put]]
|
||||
// since otherwise we would trigger this very setter!
|
||||
Object.defineProperty(this, 'should', {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
// modify Object.prototype to have `should`
|
||||
Object.defineProperty(Object.prototype, 'should', {
|
||||
set: shouldSetter
|
||||
, get: shouldGetter
|
||||
, configurable: true
|
||||
});
|
||||
|
||||
var should = {};
|
||||
|
||||
/**
|
||||
* ### .fail([message])
|
||||
* ### .fail(actual, expected, [message], [operator])
|
||||
*
|
||||
* Throw a failure.
|
||||
*
|
||||
* should.fail();
|
||||
* should.fail("custom error message");
|
||||
* should.fail(1, 2);
|
||||
* should.fail(1, 2, "custom error message");
|
||||
* should.fail(1, 2, "custom error message", ">");
|
||||
* should.fail(1, 2, undefined, ">");
|
||||
*
|
||||
*
|
||||
* @name fail
|
||||
* @param {Mixed} actual
|
||||
* @param {Mixed} expected
|
||||
* @param {String} message
|
||||
* @param {String} operator
|
||||
* @namespace BDD
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.fail = function (actual, expected, message, operator) {
|
||||
if (arguments.length < 2) {
|
||||
message = actual;
|
||||
actual = undefined;
|
||||
}
|
||||
|
||||
message = message || 'should.fail()';
|
||||
throw new chai.AssertionError(message, {
|
||||
actual: actual
|
||||
, expected: expected
|
||||
, operator: operator
|
||||
}, should.fail);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .equal(actual, expected, [message])
|
||||
*
|
||||
* Asserts non-strict equality (`==`) of `actual` and `expected`.
|
||||
*
|
||||
* should.equal(3, '3', '== coerces values to strings');
|
||||
*
|
||||
* @name equal
|
||||
* @param {Mixed} actual
|
||||
* @param {Mixed} expected
|
||||
* @param {String} message
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.equal = function (val1, val2, msg) {
|
||||
new Assertion(val1, msg).to.equal(val2);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .throw(function, [constructor/string/regexp], [string/regexp], [message])
|
||||
*
|
||||
* Asserts that `function` will throw an error that is an instance of
|
||||
* `constructor`, or alternately that it will throw an error with message
|
||||
* matching `regexp`.
|
||||
*
|
||||
* should.throw(fn, 'function throws a reference error');
|
||||
* should.throw(fn, /function throws a reference error/);
|
||||
* should.throw(fn, ReferenceError);
|
||||
* should.throw(fn, ReferenceError, 'function throws a reference error');
|
||||
* should.throw(fn, ReferenceError, /function throws a reference error/);
|
||||
*
|
||||
* @name throw
|
||||
* @alias Throw
|
||||
* @param {Function} function
|
||||
* @param {ErrorConstructor} constructor
|
||||
* @param {RegExp} regexp
|
||||
* @param {String} message
|
||||
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.Throw = function (fn, errt, errs, msg) {
|
||||
new Assertion(fn, msg).to.Throw(errt, errs);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .exist
|
||||
*
|
||||
* Asserts that the target is neither `null` nor `undefined`.
|
||||
*
|
||||
* var foo = 'hi';
|
||||
*
|
||||
* should.exist(foo, 'foo exists');
|
||||
*
|
||||
* @name exist
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.exist = function (val, msg) {
|
||||
new Assertion(val, msg).to.exist;
|
||||
}
|
||||
|
||||
// negation
|
||||
should.not = {}
|
||||
|
||||
/**
|
||||
* ### .not.equal(actual, expected, [message])
|
||||
*
|
||||
* Asserts non-strict inequality (`!=`) of `actual` and `expected`.
|
||||
*
|
||||
* should.not.equal(3, 4, 'these numbers are not equal');
|
||||
*
|
||||
* @name not.equal
|
||||
* @param {Mixed} actual
|
||||
* @param {Mixed} expected
|
||||
* @param {String} message
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.not.equal = function (val1, val2, msg) {
|
||||
new Assertion(val1, msg).to.not.equal(val2);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .throw(function, [constructor/regexp], [message])
|
||||
*
|
||||
* Asserts that `function` will _not_ throw an error that is an instance of
|
||||
* `constructor`, or alternately that it will not throw an error with message
|
||||
* matching `regexp`.
|
||||
*
|
||||
* should.not.throw(fn, Error, 'function does not throw');
|
||||
*
|
||||
* @name not.throw
|
||||
* @alias not.Throw
|
||||
* @param {Function} function
|
||||
* @param {ErrorConstructor} constructor
|
||||
* @param {RegExp} regexp
|
||||
* @param {String} message
|
||||
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.not.Throw = function (fn, errt, errs, msg) {
|
||||
new Assertion(fn, msg).to.not.Throw(errt, errs);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .not.exist
|
||||
*
|
||||
* Asserts that the target is neither `null` nor `undefined`.
|
||||
*
|
||||
* var bar = null;
|
||||
*
|
||||
* should.not.exist(bar, 'bar does not exist');
|
||||
*
|
||||
* @name not.exist
|
||||
* @namespace Should
|
||||
* @api public
|
||||
*/
|
||||
|
||||
should.not.exist = function (val, msg) {
|
||||
new Assertion(val, msg).to.not.exist;
|
||||
}
|
||||
|
||||
should['throw'] = should['Throw'];
|
||||
should.not['throw'] = should.not['Throw'];
|
||||
|
||||
return should;
|
||||
};
|
||||
|
||||
chai.should = loadShould;
|
||||
chai.Should = loadShould;
|
||||
};
|
152
node_modules/chai/lib/chai/utils/addChainableMethod.js
generated
vendored
Normal file
152
node_modules/chai/lib/chai/utils/addChainableMethod.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/*!
|
||||
* Chai - addChainingMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var addLengthGuard = require('./addLengthGuard');
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var proxify = require('./proxify');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/*!
|
||||
* Module variables
|
||||
*/
|
||||
|
||||
// Check whether `Object.setPrototypeOf` is supported
|
||||
var canSetPrototype = typeof Object.setPrototypeOf === 'function';
|
||||
|
||||
// Without `Object.setPrototypeOf` support, this module will need to add properties to a function.
|
||||
// However, some of functions' own props are not configurable and should be skipped.
|
||||
var testFn = function() {};
|
||||
var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
|
||||
var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
|
||||
|
||||
// Note: PhantomJS 1.x includes `callee` as one of `testFn`'s own properties,
|
||||
// but then returns `undefined` as the property descriptor for `callee`. As a
|
||||
// workaround, we perform an otherwise unnecessary type-check for `propDesc`,
|
||||
// and then filter it out if it's not an object as it should be.
|
||||
if (typeof propDesc !== 'object')
|
||||
return true;
|
||||
|
||||
return !propDesc.configurable;
|
||||
});
|
||||
|
||||
// Cache `Function` properties
|
||||
var call = Function.prototype.call,
|
||||
apply = Function.prototype.apply;
|
||||
|
||||
/**
|
||||
* ### .addChainableMethod(ctx, name, method, chainingBehavior)
|
||||
*
|
||||
* Adds a method to an object, such that the method can also be chained.
|
||||
*
|
||||
* utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* new chai.Assertion(obj).to.be.equal(str);
|
||||
* });
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.addChainableMethod('foo', fn, chainingBehavior);
|
||||
*
|
||||
* The result can then be used as both a method assertion, executing both `method` and
|
||||
* `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`.
|
||||
*
|
||||
* expect(fooStr).to.be.foo('bar');
|
||||
* expect(fooStr).to.be.foo.equal('foo');
|
||||
*
|
||||
* @param {Object} ctx object to which the method is added
|
||||
* @param {String} name of method to add
|
||||
* @param {Function} method function to be used for `name`, when called
|
||||
* @param {Function} chainingBehavior function to be called every time the property is accessed
|
||||
* @namespace Utils
|
||||
* @name addChainableMethod
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function addChainableMethod(ctx, name, method, chainingBehavior) {
|
||||
if (typeof chainingBehavior !== 'function') {
|
||||
chainingBehavior = function () { };
|
||||
}
|
||||
|
||||
var chainableBehavior = {
|
||||
method: method
|
||||
, chainingBehavior: chainingBehavior
|
||||
};
|
||||
|
||||
// save the methods so we can overwrite them later, if we need to.
|
||||
if (!ctx.__methods) {
|
||||
ctx.__methods = {};
|
||||
}
|
||||
ctx.__methods[name] = chainableBehavior;
|
||||
|
||||
Object.defineProperty(ctx, name,
|
||||
{ get: function chainableMethodGetter() {
|
||||
chainableBehavior.chainingBehavior.call(this);
|
||||
|
||||
var chainableMethodWrapper = function () {
|
||||
// Setting the `ssfi` flag to `chainableMethodWrapper` causes this
|
||||
// function to be the starting point for removing implementation
|
||||
// frames from the stack trace of a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if
|
||||
// the `lockSsfi` flag isn't set.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then this assertion is being
|
||||
// invoked from inside of another assertion. In this case, the `ssfi`
|
||||
// flag has already been set by the outer assertion.
|
||||
//
|
||||
// Note that overwriting a chainable method merely replaces the saved
|
||||
// methods in `ctx.__methods` instead of completely replacing the
|
||||
// overwritten assertion. Therefore, an overwriting assertion won't
|
||||
// set the `ssfi` or `lockSsfi` flags.
|
||||
if (!flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', chainableMethodWrapper);
|
||||
}
|
||||
|
||||
var result = chainableBehavior.method.apply(this, arguments);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
|
||||
addLengthGuard(chainableMethodWrapper, name, true);
|
||||
|
||||
// Use `Object.setPrototypeOf` if available
|
||||
if (canSetPrototype) {
|
||||
// Inherit all properties from the object by replacing the `Function` prototype
|
||||
var prototype = Object.create(this);
|
||||
// Restore the `call` and `apply` methods from `Function`
|
||||
prototype.call = call;
|
||||
prototype.apply = apply;
|
||||
Object.setPrototypeOf(chainableMethodWrapper, prototype);
|
||||
}
|
||||
// Otherwise, redefine all properties (slow!)
|
||||
else {
|
||||
var asserterNames = Object.getOwnPropertyNames(ctx);
|
||||
asserterNames.forEach(function (asserterName) {
|
||||
if (excludeNames.indexOf(asserterName) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
||||
Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
||||
});
|
||||
}
|
||||
|
||||
transferFlags(this, chainableMethodWrapper);
|
||||
return proxify(chainableMethodWrapper);
|
||||
}
|
||||
, configurable: true
|
||||
});
|
||||
};
|
60
node_modules/chai/lib/chai/utils/addLengthGuard.js
generated
vendored
Normal file
60
node_modules/chai/lib/chai/utils/addLengthGuard.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
var fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length');
|
||||
|
||||
/*!
|
||||
* Chai - addLengthGuard utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .addLengthGuard(fn, assertionName, isChainable)
|
||||
*
|
||||
* Define `length` as a getter on the given uninvoked method assertion. The
|
||||
* getter acts as a guard against chaining `length` directly off of an uninvoked
|
||||
* method assertion, which is a problem because it references `function`'s
|
||||
* built-in `length` property instead of Chai's `length` assertion. When the
|
||||
* getter catches the user making this mistake, it throws an error with a
|
||||
* helpful message.
|
||||
*
|
||||
* There are two ways in which this mistake can be made. The first way is by
|
||||
* chaining the `length` assertion directly off of an uninvoked chainable
|
||||
* method. In this case, Chai suggests that the user use `lengthOf` instead. The
|
||||
* second way is by chaining the `length` assertion directly off of an uninvoked
|
||||
* non-chainable method. Non-chainable methods must be invoked prior to
|
||||
* chaining. In this case, Chai suggests that the user consult the docs for the
|
||||
* given assertion.
|
||||
*
|
||||
* If the `length` property of functions is unconfigurable, then return `fn`
|
||||
* without modification.
|
||||
*
|
||||
* Note that in ES6, the function's `length` property is configurable, so once
|
||||
* support for legacy environments is dropped, Chai's `length` property can
|
||||
* replace the built-in function's `length` property, and this length guard will
|
||||
* no longer be necessary. In the mean time, maintaining consistency across all
|
||||
* environments is the priority.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @param {String} assertionName
|
||||
* @param {Boolean} isChainable
|
||||
* @namespace Utils
|
||||
* @name addLengthGuard
|
||||
*/
|
||||
|
||||
module.exports = function addLengthGuard (fn, assertionName, isChainable) {
|
||||
if (!fnLengthDesc.configurable) return fn;
|
||||
|
||||
Object.defineProperty(fn, 'length', {
|
||||
get: function () {
|
||||
if (isChainable) {
|
||||
throw Error('Invalid Chai property: ' + assertionName + '.length. Due' +
|
||||
' to a compatibility issue, "length" cannot directly follow "' +
|
||||
assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
|
||||
}
|
||||
|
||||
throw Error('Invalid Chai property: ' + assertionName + '.length. See' +
|
||||
' docs for proper usage of "' + assertionName + '".');
|
||||
}
|
||||
});
|
||||
|
||||
return fn;
|
||||
};
|
68
node_modules/chai/lib/chai/utils/addMethod.js
generated
vendored
Normal file
68
node_modules/chai/lib/chai/utils/addMethod.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*!
|
||||
* Chai - addMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var addLengthGuard = require('./addLengthGuard');
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var proxify = require('./proxify');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .addMethod(ctx, name, method)
|
||||
*
|
||||
* Adds a method to the prototype of an object.
|
||||
*
|
||||
* utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* new chai.Assertion(obj).to.be.equal(str);
|
||||
* });
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.addMethod('foo', fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(fooStr).to.be.foo('bar');
|
||||
*
|
||||
* @param {Object} ctx object to which the method is added
|
||||
* @param {String} name of method to add
|
||||
* @param {Function} method function to be used for name
|
||||
* @namespace Utils
|
||||
* @name addMethod
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function addMethod(ctx, name, method) {
|
||||
var methodWrapper = function () {
|
||||
// Setting the `ssfi` flag to `methodWrapper` causes this function to be the
|
||||
// starting point for removing implementation frames from the stack trace of
|
||||
// a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if the
|
||||
// `lockSsfi` flag isn't set.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then either this assertion has been
|
||||
// overwritten by another assertion, or this assertion is being invoked from
|
||||
// inside of another assertion. In the first case, the `ssfi` flag has
|
||||
// already been set by the overwriting assertion. In the second case, the
|
||||
// `ssfi` flag has already been set by the outer assertion.
|
||||
if (!flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', methodWrapper);
|
||||
}
|
||||
|
||||
var result = method.apply(this, arguments);
|
||||
if (result !== undefined)
|
||||
return result;
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
|
||||
addLengthGuard(methodWrapper, name, false);
|
||||
ctx[name] = proxify(methodWrapper, name);
|
||||
};
|
72
node_modules/chai/lib/chai/utils/addProperty.js
generated
vendored
Normal file
72
node_modules/chai/lib/chai/utils/addProperty.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*!
|
||||
* Chai - addProperty utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var isProxyEnabled = require('./isProxyEnabled');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .addProperty(ctx, name, getter)
|
||||
*
|
||||
* Adds a property to the prototype of an object.
|
||||
*
|
||||
* utils.addProperty(chai.Assertion.prototype, 'foo', function () {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* new chai.Assertion(obj).to.be.instanceof(Foo);
|
||||
* });
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.addProperty('foo', fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(myFoo).to.be.foo;
|
||||
*
|
||||
* @param {Object} ctx object to which the property is added
|
||||
* @param {String} name of property to add
|
||||
* @param {Function} getter function to be used for name
|
||||
* @namespace Utils
|
||||
* @name addProperty
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function addProperty(ctx, name, getter) {
|
||||
getter = getter === undefined ? function () {} : getter;
|
||||
|
||||
Object.defineProperty(ctx, name,
|
||||
{ get: function propertyGetter() {
|
||||
// Setting the `ssfi` flag to `propertyGetter` causes this function to
|
||||
// be the starting point for removing implementation frames from the
|
||||
// stack trace of a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if
|
||||
// the `lockSsfi` flag isn't set and proxy protection is disabled.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then either this assertion has been
|
||||
// overwritten by another assertion, or this assertion is being invoked
|
||||
// from inside of another assertion. In the first case, the `ssfi` flag
|
||||
// has already been set by the overwriting assertion. In the second
|
||||
// case, the `ssfi` flag has already been set by the outer assertion.
|
||||
//
|
||||
// If proxy protection is enabled, then the `ssfi` flag has already been
|
||||
// set by the proxy getter.
|
||||
if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', propertyGetter);
|
||||
}
|
||||
|
||||
var result = getter.call(this);
|
||||
if (result !== undefined)
|
||||
return result;
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
}
|
||||
, configurable: true
|
||||
});
|
||||
};
|
31
node_modules/chai/lib/chai/utils/compareByInspect.js
generated
vendored
Normal file
31
node_modules/chai/lib/chai/utils/compareByInspect.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*!
|
||||
* Chai - compareByInspect utility
|
||||
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var inspect = require('./inspect');
|
||||
|
||||
/**
|
||||
* ### .compareByInspect(mixed, mixed)
|
||||
*
|
||||
* To be used as a compareFunction with Array.prototype.sort. Compares elements
|
||||
* using inspect instead of default behavior of using toString so that Symbols
|
||||
* and objects with irregular/missing toString can still be sorted without a
|
||||
* TypeError.
|
||||
*
|
||||
* @param {Mixed} first element to compare
|
||||
* @param {Mixed} second element to compare
|
||||
* @returns {Number} -1 if 'a' should come before 'b'; otherwise 1
|
||||
* @name compareByInspect
|
||||
* @namespace Utils
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function compareByInspect(a, b) {
|
||||
return inspect(a) < inspect(b) ? -1 : 1;
|
||||
};
|
51
node_modules/chai/lib/chai/utils/expectTypes.js
generated
vendored
Normal file
51
node_modules/chai/lib/chai/utils/expectTypes.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*!
|
||||
* Chai - expectTypes utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .expectTypes(obj, types)
|
||||
*
|
||||
* Ensures that the object being tested against is of a valid type.
|
||||
*
|
||||
* utils.expectTypes(this, ['array', 'object', 'string']);
|
||||
*
|
||||
* @param {Mixed} obj constructed Assertion
|
||||
* @param {Array} type A list of allowed types for this assertion
|
||||
* @namespace Utils
|
||||
* @name expectTypes
|
||||
* @api public
|
||||
*/
|
||||
|
||||
var AssertionError = require('assertion-error');
|
||||
var flag = require('./flag');
|
||||
var type = require('type-detect');
|
||||
|
||||
module.exports = function expectTypes(obj, types) {
|
||||
var flagMsg = flag(obj, 'message');
|
||||
var ssfi = flag(obj, 'ssfi');
|
||||
|
||||
flagMsg = flagMsg ? flagMsg + ': ' : '';
|
||||
|
||||
obj = flag(obj, 'object');
|
||||
types = types.map(function (t) { return t.toLowerCase(); });
|
||||
types.sort();
|
||||
|
||||
// Transforms ['lorem', 'ipsum'] into 'a lorem, or an ipsum'
|
||||
var str = types.map(function (t, index) {
|
||||
var art = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(t.charAt(0)) ? 'an' : 'a';
|
||||
var or = types.length > 1 && index === types.length - 1 ? 'or ' : '';
|
||||
return or + art + ' ' + t;
|
||||
}).join(', ');
|
||||
|
||||
var objType = type(obj).toLowerCase();
|
||||
|
||||
if (!types.some(function (expected) { return objType === expected; })) {
|
||||
throw new AssertionError(
|
||||
flagMsg + 'object tested must be ' + str + ', but ' + objType + ' given',
|
||||
undefined,
|
||||
ssfi
|
||||
);
|
||||
}
|
||||
};
|
33
node_modules/chai/lib/chai/utils/flag.js
generated
vendored
Normal file
33
node_modules/chai/lib/chai/utils/flag.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*!
|
||||
* Chai - flag utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .flag(object, key, [value])
|
||||
*
|
||||
* Get or set a flag value on an object. If a
|
||||
* value is provided it will be set, else it will
|
||||
* return the currently set value or `undefined` if
|
||||
* the value is not set.
|
||||
*
|
||||
* utils.flag(this, 'foo', 'bar'); // setter
|
||||
* utils.flag(this, 'foo'); // getter, returns `bar`
|
||||
*
|
||||
* @param {Object} object constructed Assertion
|
||||
* @param {String} key
|
||||
* @param {Mixed} value (optional)
|
||||
* @namespace Utils
|
||||
* @name flag
|
||||
* @api private
|
||||
*/
|
||||
|
||||
module.exports = function flag(obj, key, value) {
|
||||
var flags = obj.__flags || (obj.__flags = Object.create(null));
|
||||
if (arguments.length === 3) {
|
||||
flags[key] = value;
|
||||
} else {
|
||||
return flags[key];
|
||||
}
|
||||
};
|
20
node_modules/chai/lib/chai/utils/getActual.js
generated
vendored
Normal file
20
node_modules/chai/lib/chai/utils/getActual.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*!
|
||||
* Chai - getActual utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .getActual(object, [actual])
|
||||
*
|
||||
* Returns the `actual` value for an Assertion.
|
||||
*
|
||||
* @param {Object} object (constructed Assertion)
|
||||
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
||||
* @namespace Utils
|
||||
* @name getActual
|
||||
*/
|
||||
|
||||
module.exports = function getActual(obj, args) {
|
||||
return args.length > 4 ? args[4] : obj._obj;
|
||||
};
|
26
node_modules/chai/lib/chai/utils/getEnumerableProperties.js
generated
vendored
Normal file
26
node_modules/chai/lib/chai/utils/getEnumerableProperties.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Chai - getEnumerableProperties utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .getEnumerableProperties(object)
|
||||
*
|
||||
* This allows the retrieval of enumerable property names of an object,
|
||||
* inherited or not.
|
||||
*
|
||||
* @param {Object} object
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getEnumerableProperties
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getEnumerableProperties(object) {
|
||||
var result = [];
|
||||
for (var name in object) {
|
||||
result.push(name);
|
||||
}
|
||||
return result;
|
||||
};
|
50
node_modules/chai/lib/chai/utils/getMessage.js
generated
vendored
Normal file
50
node_modules/chai/lib/chai/utils/getMessage.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/*!
|
||||
* Chai - message composition utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var flag = require('./flag')
|
||||
, getActual = require('./getActual')
|
||||
, objDisplay = require('./objDisplay');
|
||||
|
||||
/**
|
||||
* ### .getMessage(object, message, negateMessage)
|
||||
*
|
||||
* Construct the error message based on flags
|
||||
* and template tags. Template tags will return
|
||||
* a stringified inspection of the object referenced.
|
||||
*
|
||||
* Message template tags:
|
||||
* - `#{this}` current asserted object
|
||||
* - `#{act}` actual value
|
||||
* - `#{exp}` expected value
|
||||
*
|
||||
* @param {Object} object (constructed Assertion)
|
||||
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
||||
* @namespace Utils
|
||||
* @name getMessage
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getMessage(obj, args) {
|
||||
var negate = flag(obj, 'negate')
|
||||
, val = flag(obj, 'object')
|
||||
, expected = args[3]
|
||||
, actual = getActual(obj, args)
|
||||
, msg = negate ? args[2] : args[1]
|
||||
, flagMsg = flag(obj, 'message');
|
||||
|
||||
if(typeof msg === "function") msg = msg();
|
||||
msg = msg || '';
|
||||
msg = msg
|
||||
.replace(/#\{this\}/g, function () { return objDisplay(val); })
|
||||
.replace(/#\{act\}/g, function () { return objDisplay(actual); })
|
||||
.replace(/#\{exp\}/g, function () { return objDisplay(expected); });
|
||||
|
||||
return flagMsg ? flagMsg + ': ' + msg : msg;
|
||||
};
|
55
node_modules/chai/lib/chai/utils/getOperator.js
generated
vendored
Normal file
55
node_modules/chai/lib/chai/utils/getOperator.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
var type = require('type-detect');
|
||||
|
||||
var flag = require('./flag');
|
||||
|
||||
function isObjectType(obj) {
|
||||
var objectType = type(obj);
|
||||
var objectTypes = ['Array', 'Object', 'function'];
|
||||
|
||||
return objectTypes.indexOf(objectType) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* ### .getOperator(message)
|
||||
*
|
||||
* Extract the operator from error message.
|
||||
* Operator defined is based on below link
|
||||
* https://nodejs.org/api/assert.html#assert_assert.
|
||||
*
|
||||
* Returns the `operator` or `undefined` value for an Assertion.
|
||||
*
|
||||
* @param {Object} object (constructed Assertion)
|
||||
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
||||
* @namespace Utils
|
||||
* @name getOperator
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getOperator(obj, args) {
|
||||
var operator = flag(obj, 'operator');
|
||||
var negate = flag(obj, 'negate');
|
||||
var expected = args[3];
|
||||
var msg = negate ? args[2] : args[1];
|
||||
|
||||
if (operator) {
|
||||
return operator;
|
||||
}
|
||||
|
||||
if (typeof msg === 'function') msg = msg();
|
||||
|
||||
msg = msg || '';
|
||||
if (!msg) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (/\shave\s/.test(msg)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var isObject = isObjectType(expected);
|
||||
if (/\snot\s/.test(msg)) {
|
||||
return isObject ? 'notDeepStrictEqual' : 'notStrictEqual';
|
||||
}
|
||||
|
||||
return isObject ? 'deepStrictEqual' : 'strictEqual';
|
||||
};
|
29
node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js
generated
vendored
Normal file
29
node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*!
|
||||
* Chai - getOwnEnumerableProperties utility
|
||||
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols');
|
||||
|
||||
/**
|
||||
* ### .getOwnEnumerableProperties(object)
|
||||
*
|
||||
* This allows the retrieval of directly-owned enumerable property names and
|
||||
* symbols of an object. This function is necessary because Object.keys only
|
||||
* returns enumerable property names, not enumerable property symbols.
|
||||
*
|
||||
* @param {Object} object
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getOwnEnumerableProperties
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getOwnEnumerableProperties(obj) {
|
||||
return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
|
||||
};
|
27
node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js
generated
vendored
Normal file
27
node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*!
|
||||
* Chai - getOwnEnumerablePropertySymbols utility
|
||||
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .getOwnEnumerablePropertySymbols(object)
|
||||
*
|
||||
* This allows the retrieval of directly-owned enumerable property symbols of an
|
||||
* object. This function is necessary because Object.getOwnPropertySymbols
|
||||
* returns both enumerable and non-enumerable property symbols.
|
||||
*
|
||||
* @param {Object} object
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getOwnEnumerablePropertySymbols
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getOwnEnumerablePropertySymbols(obj) {
|
||||
if (typeof Object.getOwnPropertySymbols !== 'function') return [];
|
||||
|
||||
return Object.getOwnPropertySymbols(obj).filter(function (sym) {
|
||||
return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
|
||||
});
|
||||
};
|
36
node_modules/chai/lib/chai/utils/getProperties.js
generated
vendored
Normal file
36
node_modules/chai/lib/chai/utils/getProperties.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* Chai - getProperties utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .getProperties(object)
|
||||
*
|
||||
* This allows the retrieval of property names of an object, enumerable or not,
|
||||
* inherited or not.
|
||||
*
|
||||
* @param {Object} object
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getProperties
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function getProperties(object) {
|
||||
var result = Object.getOwnPropertyNames(object);
|
||||
|
||||
function addProperty(property) {
|
||||
if (result.indexOf(property) === -1) {
|
||||
result.push(property);
|
||||
}
|
||||
}
|
||||
|
||||
var proto = Object.getPrototypeOf(object);
|
||||
while (proto !== null) {
|
||||
Object.getOwnPropertyNames(proto).forEach(addProperty);
|
||||
proto = Object.getPrototypeOf(proto);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
178
node_modules/chai/lib/chai/utils/index.js
generated
vendored
Normal file
178
node_modules/chai/lib/chai/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Dependencies that are used for multiple exports are required here only once
|
||||
*/
|
||||
|
||||
var pathval = require('pathval');
|
||||
|
||||
/*!
|
||||
* test utility
|
||||
*/
|
||||
|
||||
exports.test = require('./test');
|
||||
|
||||
/*!
|
||||
* type utility
|
||||
*/
|
||||
|
||||
exports.type = require('type-detect');
|
||||
|
||||
/*!
|
||||
* expectTypes utility
|
||||
*/
|
||||
exports.expectTypes = require('./expectTypes');
|
||||
|
||||
/*!
|
||||
* message utility
|
||||
*/
|
||||
|
||||
exports.getMessage = require('./getMessage');
|
||||
|
||||
/*!
|
||||
* actual utility
|
||||
*/
|
||||
|
||||
exports.getActual = require('./getActual');
|
||||
|
||||
/*!
|
||||
* Inspect util
|
||||
*/
|
||||
|
||||
exports.inspect = require('./inspect');
|
||||
|
||||
/*!
|
||||
* Object Display util
|
||||
*/
|
||||
|
||||
exports.objDisplay = require('./objDisplay');
|
||||
|
||||
/*!
|
||||
* Flag utility
|
||||
*/
|
||||
|
||||
exports.flag = require('./flag');
|
||||
|
||||
/*!
|
||||
* Flag transferring utility
|
||||
*/
|
||||
|
||||
exports.transferFlags = require('./transferFlags');
|
||||
|
||||
/*!
|
||||
* Deep equal utility
|
||||
*/
|
||||
|
||||
exports.eql = require('deep-eql');
|
||||
|
||||
/*!
|
||||
* Deep path info
|
||||
*/
|
||||
|
||||
exports.getPathInfo = pathval.getPathInfo;
|
||||
|
||||
/*!
|
||||
* Check if a property exists
|
||||
*/
|
||||
|
||||
exports.hasProperty = pathval.hasProperty;
|
||||
|
||||
/*!
|
||||
* Function name
|
||||
*/
|
||||
|
||||
exports.getName = require('get-func-name');
|
||||
|
||||
/*!
|
||||
* add Property
|
||||
*/
|
||||
|
||||
exports.addProperty = require('./addProperty');
|
||||
|
||||
/*!
|
||||
* add Method
|
||||
*/
|
||||
|
||||
exports.addMethod = require('./addMethod');
|
||||
|
||||
/*!
|
||||
* overwrite Property
|
||||
*/
|
||||
|
||||
exports.overwriteProperty = require('./overwriteProperty');
|
||||
|
||||
/*!
|
||||
* overwrite Method
|
||||
*/
|
||||
|
||||
exports.overwriteMethod = require('./overwriteMethod');
|
||||
|
||||
/*!
|
||||
* Add a chainable method
|
||||
*/
|
||||
|
||||
exports.addChainableMethod = require('./addChainableMethod');
|
||||
|
||||
/*!
|
||||
* Overwrite chainable method
|
||||
*/
|
||||
|
||||
exports.overwriteChainableMethod = require('./overwriteChainableMethod');
|
||||
|
||||
/*!
|
||||
* Compare by inspect method
|
||||
*/
|
||||
|
||||
exports.compareByInspect = require('./compareByInspect');
|
||||
|
||||
/*!
|
||||
* Get own enumerable property symbols method
|
||||
*/
|
||||
|
||||
exports.getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols');
|
||||
|
||||
/*!
|
||||
* Get own enumerable properties method
|
||||
*/
|
||||
|
||||
exports.getOwnEnumerableProperties = require('./getOwnEnumerableProperties');
|
||||
|
||||
/*!
|
||||
* Checks error against a given set of criteria
|
||||
*/
|
||||
|
||||
exports.checkError = require('check-error');
|
||||
|
||||
/*!
|
||||
* Proxify util
|
||||
*/
|
||||
|
||||
exports.proxify = require('./proxify');
|
||||
|
||||
/*!
|
||||
* addLengthGuard util
|
||||
*/
|
||||
|
||||
exports.addLengthGuard = require('./addLengthGuard');
|
||||
|
||||
/*!
|
||||
* isProxyEnabled helper
|
||||
*/
|
||||
|
||||
exports.isProxyEnabled = require('./isProxyEnabled');
|
||||
|
||||
/*!
|
||||
* isNaN method
|
||||
*/
|
||||
|
||||
exports.isNaN = require('./isNaN');
|
||||
|
||||
/*!
|
||||
* getOperator method
|
||||
*/
|
||||
|
||||
exports.getOperator = require('./getOperator');
|
33
node_modules/chai/lib/chai/utils/inspect.js
generated
vendored
Normal file
33
node_modules/chai/lib/chai/utils/inspect.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// This is (almost) directly from Node.js utils
|
||||
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
|
||||
|
||||
var getName = require('get-func-name');
|
||||
var loupe = require('loupe');
|
||||
var config = require('../config');
|
||||
|
||||
module.exports = inspect;
|
||||
|
||||
/**
|
||||
* ### .inspect(obj, [showHidden], [depth], [colors])
|
||||
*
|
||||
* Echoes the value of a value. Tries to print the value out
|
||||
* in the best way possible given the different types.
|
||||
*
|
||||
* @param {Object} obj The object to print out.
|
||||
* @param {Boolean} showHidden Flag that shows hidden (not enumerable)
|
||||
* properties of objects. Default is false.
|
||||
* @param {Number} depth Depth in which to descend in object. Default is 2.
|
||||
* @param {Boolean} colors Flag to turn on ANSI escape codes to color the
|
||||
* output. Default is false (no coloring).
|
||||
* @namespace Utils
|
||||
* @name inspect
|
||||
*/
|
||||
function inspect(obj, showHidden, depth, colors) {
|
||||
var options = {
|
||||
colors: colors,
|
||||
depth: (typeof depth === 'undefined' ? 2 : depth),
|
||||
showHidden: showHidden,
|
||||
truncate: config.truncateThreshold ? config.truncateThreshold : Infinity,
|
||||
};
|
||||
return loupe.inspect(obj, options);
|
||||
}
|
26
node_modules/chai/lib/chai/utils/isNaN.js
generated
vendored
Normal file
26
node_modules/chai/lib/chai/utils/isNaN.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Chai - isNaN utility
|
||||
* Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .isNaN(value)
|
||||
*
|
||||
* Checks if the given value is NaN or not.
|
||||
*
|
||||
* utils.isNaN(NaN); // true
|
||||
*
|
||||
* @param {Value} The value which has to be checked if it is NaN
|
||||
* @name isNaN
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function isNaN(value) {
|
||||
// Refer http://www.ecma-international.org/ecma-262/6.0/#sec-isnan-number
|
||||
// section's NOTE.
|
||||
return value !== value;
|
||||
}
|
||||
|
||||
// If ECMAScript 6's Number.isNaN is present, prefer that.
|
||||
module.exports = Number.isNaN || isNaN;
|
24
node_modules/chai/lib/chai/utils/isProxyEnabled.js
generated
vendored
Normal file
24
node_modules/chai/lib/chai/utils/isProxyEnabled.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var config = require('../config');
|
||||
|
||||
/*!
|
||||
* Chai - isProxyEnabled helper
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .isProxyEnabled()
|
||||
*
|
||||
* Helper function to check if Chai's proxy protection feature is enabled. If
|
||||
* proxies are unsupported or disabled via the user's Chai config, then return
|
||||
* false. Otherwise, return true.
|
||||
*
|
||||
* @namespace Utils
|
||||
* @name isProxyEnabled
|
||||
*/
|
||||
|
||||
module.exports = function isProxyEnabled() {
|
||||
return config.useProxy &&
|
||||
typeof Proxy !== 'undefined' &&
|
||||
typeof Reflect !== 'undefined';
|
||||
};
|
50
node_modules/chai/lib/chai/utils/objDisplay.js
generated
vendored
Normal file
50
node_modules/chai/lib/chai/utils/objDisplay.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/*!
|
||||
* Chai - flag utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var inspect = require('./inspect');
|
||||
var config = require('../config');
|
||||
|
||||
/**
|
||||
* ### .objDisplay(object)
|
||||
*
|
||||
* Determines if an object or an array matches
|
||||
* criteria to be inspected in-line for error
|
||||
* messages or should be truncated.
|
||||
*
|
||||
* @param {Mixed} javascript object to inspect
|
||||
* @name objDisplay
|
||||
* @namespace Utils
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function objDisplay(obj) {
|
||||
var str = inspect(obj)
|
||||
, type = Object.prototype.toString.call(obj);
|
||||
|
||||
if (config.truncateThreshold && str.length >= config.truncateThreshold) {
|
||||
if (type === '[object Function]') {
|
||||
return !obj.name || obj.name === ''
|
||||
? '[Function]'
|
||||
: '[Function: ' + obj.name + ']';
|
||||
} else if (type === '[object Array]') {
|
||||
return '[ Array(' + obj.length + ') ]';
|
||||
} else if (type === '[object Object]') {
|
||||
var keys = Object.keys(obj)
|
||||
, kstr = keys.length > 2
|
||||
? keys.splice(0, 2).join(', ') + ', ...'
|
||||
: keys.join(', ');
|
||||
return '{ Object (' + kstr + ') }';
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
};
|
69
node_modules/chai/lib/chai/utils/overwriteChainableMethod.js
generated
vendored
Normal file
69
node_modules/chai/lib/chai/utils/overwriteChainableMethod.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* Chai - overwriteChainableMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var chai = require('../../chai');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .overwriteChainableMethod(ctx, name, method, chainingBehavior)
|
||||
*
|
||||
* Overwrites an already existing chainable method
|
||||
* and provides access to the previous function or
|
||||
* property. Must return functions to be used for
|
||||
* name.
|
||||
*
|
||||
* utils.overwriteChainableMethod(chai.Assertion.prototype, 'lengthOf',
|
||||
* function (_super) {
|
||||
* }
|
||||
* , function (_super) {
|
||||
* }
|
||||
* );
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.overwriteChainableMethod('foo', fn, fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(myFoo).to.have.lengthOf(3);
|
||||
* expect(myFoo).to.have.lengthOf.above(3);
|
||||
*
|
||||
* @param {Object} ctx object whose method / property is to be overwritten
|
||||
* @param {String} name of method / property to overwrite
|
||||
* @param {Function} method function that returns a function to be used for name
|
||||
* @param {Function} chainingBehavior function that returns a function to be used for property
|
||||
* @namespace Utils
|
||||
* @name overwriteChainableMethod
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
|
||||
var chainableBehavior = ctx.__methods[name];
|
||||
|
||||
var _chainingBehavior = chainableBehavior.chainingBehavior;
|
||||
chainableBehavior.chainingBehavior = function overwritingChainableMethodGetter() {
|
||||
var result = chainingBehavior(_chainingBehavior).call(this);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
|
||||
var _method = chainableBehavior.method;
|
||||
chainableBehavior.method = function overwritingChainableMethodWrapper() {
|
||||
var result = method(_method).apply(this, arguments);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
};
|
92
node_modules/chai/lib/chai/utils/overwriteMethod.js
generated
vendored
Normal file
92
node_modules/chai/lib/chai/utils/overwriteMethod.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*!
|
||||
* Chai - overwriteMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var addLengthGuard = require('./addLengthGuard');
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var proxify = require('./proxify');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .overwriteMethod(ctx, name, fn)
|
||||
*
|
||||
* Overwrites an already existing method and provides
|
||||
* access to previous function. Must return function
|
||||
* to be used for name.
|
||||
*
|
||||
* utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {
|
||||
* return function (str) {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* if (obj instanceof Foo) {
|
||||
* new chai.Assertion(obj.value).to.equal(str);
|
||||
* } else {
|
||||
* _super.apply(this, arguments);
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.overwriteMethod('foo', fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(myFoo).to.equal('bar');
|
||||
*
|
||||
* @param {Object} ctx object whose method is to be overwritten
|
||||
* @param {String} name of method to overwrite
|
||||
* @param {Function} method function that returns a function to be used for name
|
||||
* @namespace Utils
|
||||
* @name overwriteMethod
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function overwriteMethod(ctx, name, method) {
|
||||
var _method = ctx[name]
|
||||
, _super = function () {
|
||||
throw new Error(name + ' is not a function');
|
||||
};
|
||||
|
||||
if (_method && 'function' === typeof _method)
|
||||
_super = _method;
|
||||
|
||||
var overwritingMethodWrapper = function () {
|
||||
// Setting the `ssfi` flag to `overwritingMethodWrapper` causes this
|
||||
// function to be the starting point for removing implementation frames from
|
||||
// the stack trace of a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if the
|
||||
// `lockSsfi` flag isn't set.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then either this assertion has been
|
||||
// overwritten by another assertion, or this assertion is being invoked from
|
||||
// inside of another assertion. In the first case, the `ssfi` flag has
|
||||
// already been set by the overwriting assertion. In the second case, the
|
||||
// `ssfi` flag has already been set by the outer assertion.
|
||||
if (!flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', overwritingMethodWrapper);
|
||||
}
|
||||
|
||||
// Setting the `lockSsfi` flag to `true` prevents the overwritten assertion
|
||||
// from changing the `ssfi` flag. By this point, the `ssfi` flag is already
|
||||
// set to the correct starting point for this assertion.
|
||||
var origLockSsfi = flag(this, 'lockSsfi');
|
||||
flag(this, 'lockSsfi', true);
|
||||
var result = method(_super).apply(this, arguments);
|
||||
flag(this, 'lockSsfi', origLockSsfi);
|
||||
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
}
|
||||
|
||||
addLengthGuard(overwritingMethodWrapper, name, false);
|
||||
ctx[name] = proxify(overwritingMethodWrapper, name);
|
||||
};
|
92
node_modules/chai/lib/chai/utils/overwriteProperty.js
generated
vendored
Normal file
92
node_modules/chai/lib/chai/utils/overwriteProperty.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*!
|
||||
* Chai - overwriteProperty utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
var chai = require('../../chai');
|
||||
var flag = require('./flag');
|
||||
var isProxyEnabled = require('./isProxyEnabled');
|
||||
var transferFlags = require('./transferFlags');
|
||||
|
||||
/**
|
||||
* ### .overwriteProperty(ctx, name, fn)
|
||||
*
|
||||
* Overwrites an already existing property getter and provides
|
||||
* access to previous value. Must return function to use as getter.
|
||||
*
|
||||
* utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) {
|
||||
* return function () {
|
||||
* var obj = utils.flag(this, 'object');
|
||||
* if (obj instanceof Foo) {
|
||||
* new chai.Assertion(obj.name).to.equal('bar');
|
||||
* } else {
|
||||
* _super.call(this);
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
*
|
||||
* Can also be accessed directly from `chai.Assertion`.
|
||||
*
|
||||
* chai.Assertion.overwriteProperty('foo', fn);
|
||||
*
|
||||
* Then can be used as any other assertion.
|
||||
*
|
||||
* expect(myFoo).to.be.ok;
|
||||
*
|
||||
* @param {Object} ctx object whose property is to be overwritten
|
||||
* @param {String} name of property to overwrite
|
||||
* @param {Function} getter function that returns a getter function to be used for name
|
||||
* @namespace Utils
|
||||
* @name overwriteProperty
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function overwriteProperty(ctx, name, getter) {
|
||||
var _get = Object.getOwnPropertyDescriptor(ctx, name)
|
||||
, _super = function () {};
|
||||
|
||||
if (_get && 'function' === typeof _get.get)
|
||||
_super = _get.get
|
||||
|
||||
Object.defineProperty(ctx, name,
|
||||
{ get: function overwritingPropertyGetter() {
|
||||
// Setting the `ssfi` flag to `overwritingPropertyGetter` causes this
|
||||
// function to be the starting point for removing implementation frames
|
||||
// from the stack trace of a failed assertion.
|
||||
//
|
||||
// However, we only want to use this function as the starting point if
|
||||
// the `lockSsfi` flag isn't set and proxy protection is disabled.
|
||||
//
|
||||
// If the `lockSsfi` flag is set, then either this assertion has been
|
||||
// overwritten by another assertion, or this assertion is being invoked
|
||||
// from inside of another assertion. In the first case, the `ssfi` flag
|
||||
// has already been set by the overwriting assertion. In the second
|
||||
// case, the `ssfi` flag has already been set by the outer assertion.
|
||||
//
|
||||
// If proxy protection is enabled, then the `ssfi` flag has already been
|
||||
// set by the proxy getter.
|
||||
if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
|
||||
flag(this, 'ssfi', overwritingPropertyGetter);
|
||||
}
|
||||
|
||||
// Setting the `lockSsfi` flag to `true` prevents the overwritten
|
||||
// assertion from changing the `ssfi` flag. By this point, the `ssfi`
|
||||
// flag is already set to the correct starting point for this assertion.
|
||||
var origLockSsfi = flag(this, 'lockSsfi');
|
||||
flag(this, 'lockSsfi', true);
|
||||
var result = getter(_super).call(this);
|
||||
flag(this, 'lockSsfi', origLockSsfi);
|
||||
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var newAssertion = new chai.Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
}
|
||||
, configurable: true
|
||||
});
|
||||
};
|
147
node_modules/chai/lib/chai/utils/proxify.js
generated
vendored
Normal file
147
node_modules/chai/lib/chai/utils/proxify.js
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
var config = require('../config');
|
||||
var flag = require('./flag');
|
||||
var getProperties = require('./getProperties');
|
||||
var isProxyEnabled = require('./isProxyEnabled');
|
||||
|
||||
/*!
|
||||
* Chai - proxify utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .proxify(object)
|
||||
*
|
||||
* Return a proxy of given object that throws an error when a non-existent
|
||||
* property is read. By default, the root cause is assumed to be a misspelled
|
||||
* property, and thus an attempt is made to offer a reasonable suggestion from
|
||||
* the list of existing properties. However, if a nonChainableMethodName is
|
||||
* provided, then the root cause is instead a failure to invoke a non-chainable
|
||||
* method prior to reading the non-existent property.
|
||||
*
|
||||
* If proxies are unsupported or disabled via the user's Chai config, then
|
||||
* return object without modification.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @param {String} nonChainableMethodName
|
||||
* @namespace Utils
|
||||
* @name proxify
|
||||
*/
|
||||
|
||||
var builtins = ['__flags', '__methods', '_obj', 'assert'];
|
||||
|
||||
module.exports = function proxify(obj, nonChainableMethodName) {
|
||||
if (!isProxyEnabled()) return obj;
|
||||
|
||||
return new Proxy(obj, {
|
||||
get: function proxyGetter(target, property) {
|
||||
// This check is here because we should not throw errors on Symbol properties
|
||||
// such as `Symbol.toStringTag`.
|
||||
// The values for which an error should be thrown can be configured using
|
||||
// the `config.proxyExcludedKeys` setting.
|
||||
if (typeof property === 'string' &&
|
||||
config.proxyExcludedKeys.indexOf(property) === -1 &&
|
||||
!Reflect.has(target, property)) {
|
||||
// Special message for invalid property access of non-chainable methods.
|
||||
if (nonChainableMethodName) {
|
||||
throw Error('Invalid Chai property: ' + nonChainableMethodName + '.' +
|
||||
property + '. See docs for proper usage of "' +
|
||||
nonChainableMethodName + '".');
|
||||
}
|
||||
|
||||
// If the property is reasonably close to an existing Chai property,
|
||||
// suggest that property to the user. Only suggest properties with a
|
||||
// distance less than 4.
|
||||
var suggestion = null;
|
||||
var suggestionDistance = 4;
|
||||
getProperties(target).forEach(function(prop) {
|
||||
if (
|
||||
!Object.prototype.hasOwnProperty(prop) &&
|
||||
builtins.indexOf(prop) === -1
|
||||
) {
|
||||
var dist = stringDistanceCapped(
|
||||
property,
|
||||
prop,
|
||||
suggestionDistance
|
||||
);
|
||||
if (dist < suggestionDistance) {
|
||||
suggestion = prop;
|
||||
suggestionDistance = dist;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (suggestion !== null) {
|
||||
throw Error('Invalid Chai property: ' + property +
|
||||
'. Did you mean "' + suggestion + '"?');
|
||||
} else {
|
||||
throw Error('Invalid Chai property: ' + property);
|
||||
}
|
||||
}
|
||||
|
||||
// Use this proxy getter as the starting point for removing implementation
|
||||
// frames from the stack trace of a failed assertion. For property
|
||||
// assertions, this prevents the proxy getter from showing up in the stack
|
||||
// trace since it's invoked before the property getter. For method and
|
||||
// chainable method assertions, this flag will end up getting changed to
|
||||
// the method wrapper, which is good since this frame will no longer be in
|
||||
// the stack once the method is invoked. Note that Chai builtin assertion
|
||||
// properties such as `__flags` are skipped since this is only meant to
|
||||
// capture the starting point of an assertion. This step is also skipped
|
||||
// if the `lockSsfi` flag is set, thus indicating that this assertion is
|
||||
// being called from within another assertion. In that case, the `ssfi`
|
||||
// flag is already set to the outer assertion's starting point.
|
||||
if (builtins.indexOf(property) === -1 && !flag(target, 'lockSsfi')) {
|
||||
flag(target, 'ssfi', proxyGetter);
|
||||
}
|
||||
|
||||
return Reflect.get(target, property);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* # stringDistanceCapped(strA, strB, cap)
|
||||
* Return the Levenshtein distance between two strings, but no more than cap.
|
||||
* @param {string} strA
|
||||
* @param {string} strB
|
||||
* @param {number} number
|
||||
* @return {number} min(string distance between strA and strB, cap)
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function stringDistanceCapped(strA, strB, cap) {
|
||||
if (Math.abs(strA.length - strB.length) >= cap) {
|
||||
return cap;
|
||||
}
|
||||
|
||||
var memo = [];
|
||||
// `memo` is a two-dimensional array containing distances.
|
||||
// memo[i][j] is the distance between strA.slice(0, i) and
|
||||
// strB.slice(0, j).
|
||||
for (var i = 0; i <= strA.length; i++) {
|
||||
memo[i] = Array(strB.length + 1).fill(0);
|
||||
memo[i][0] = i;
|
||||
}
|
||||
for (var j = 0; j < strB.length; j++) {
|
||||
memo[0][j] = j;
|
||||
}
|
||||
|
||||
for (var i = 1; i <= strA.length; i++) {
|
||||
var ch = strA.charCodeAt(i - 1);
|
||||
for (var j = 1; j <= strB.length; j++) {
|
||||
if (Math.abs(i - j) >= cap) {
|
||||
memo[i][j] = cap;
|
||||
continue;
|
||||
}
|
||||
memo[i][j] = Math.min(
|
||||
memo[i - 1][j] + 1,
|
||||
memo[i][j - 1] + 1,
|
||||
memo[i - 1][j - 1] +
|
||||
(ch === strB.charCodeAt(j - 1) ? 0 : 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return memo[strA.length][strB.length];
|
||||
}
|
28
node_modules/chai/lib/chai/utils/test.js
generated
vendored
Normal file
28
node_modules/chai/lib/chai/utils/test.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/*!
|
||||
* Chai - test utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var flag = require('./flag');
|
||||
|
||||
/**
|
||||
* ### .test(object, expression)
|
||||
*
|
||||
* Test and object for expression.
|
||||
*
|
||||
* @param {Object} object (constructed Assertion)
|
||||
* @param {Arguments} chai.Assertion.prototype.assert arguments
|
||||
* @namespace Utils
|
||||
* @name test
|
||||
*/
|
||||
|
||||
module.exports = function test(obj, args) {
|
||||
var negate = flag(obj, 'negate')
|
||||
, expr = args[0];
|
||||
return negate ? !expr : expr;
|
||||
};
|
45
node_modules/chai/lib/chai/utils/transferFlags.js
generated
vendored
Normal file
45
node_modules/chai/lib/chai/utils/transferFlags.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/*!
|
||||
* Chai - transferFlags utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* ### .transferFlags(assertion, object, includeAll = true)
|
||||
*
|
||||
* Transfer all the flags for `assertion` to `object`. If
|
||||
* `includeAll` is set to `false`, then the base Chai
|
||||
* assertion flags (namely `object`, `ssfi`, `lockSsfi`,
|
||||
* and `message`) will not be transferred.
|
||||
*
|
||||
*
|
||||
* var newAssertion = new Assertion();
|
||||
* utils.transferFlags(assertion, newAssertion);
|
||||
*
|
||||
* var anotherAssertion = new Assertion(myObj);
|
||||
* utils.transferFlags(assertion, anotherAssertion, false);
|
||||
*
|
||||
* @param {Assertion} assertion the assertion to transfer the flags from
|
||||
* @param {Object} object the object to transfer the flags to; usually a new assertion
|
||||
* @param {Boolean} includeAll
|
||||
* @namespace Utils
|
||||
* @name transferFlags
|
||||
* @api private
|
||||
*/
|
||||
|
||||
module.exports = function transferFlags(assertion, object, includeAll) {
|
||||
var flags = assertion.__flags || (assertion.__flags = Object.create(null));
|
||||
|
||||
if (!object.__flags) {
|
||||
object.__flags = Object.create(null);
|
||||
}
|
||||
|
||||
includeAll = arguments.length === 3 ? includeAll : true;
|
||||
|
||||
for (var flag in flags) {
|
||||
if (includeAll ||
|
||||
(flag !== 'object' && flag !== 'ssfi' && flag !== 'lockSsfi' && flag != 'message')) {
|
||||
object.__flags[flag] = flags[flag];
|
||||
}
|
||||
}
|
||||
};
|
63
node_modules/chai/package.json
generated
vendored
Normal file
63
node_modules/chai/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"author": "Jake Luer <jake@alogicalparadox.com>",
|
||||
"name": "chai",
|
||||
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
|
||||
"keywords": [
|
||||
"test",
|
||||
"assertion",
|
||||
"assert",
|
||||
"testing",
|
||||
"chai"
|
||||
],
|
||||
"homepage": "http://chaijs.com",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
"Jake Luer <jake@alogicalparadox.com>",
|
||||
"Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)",
|
||||
"Veselin Todorov <hi@vesln.com>",
|
||||
"John Firebaugh <john.firebaugh@gmail.com>"
|
||||
],
|
||||
"version": "4.3.6",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chaijs/chai"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chaijs/chai/issues"
|
||||
},
|
||||
"main": "./index",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./index.js",
|
||||
"import": "./index.mjs"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"dependencies": {
|
||||
"assertion-error": "^1.1.0",
|
||||
"check-error": "^1.0.2",
|
||||
"deep-eql": "^3.0.1",
|
||||
"get-func-name": "^2.0.0",
|
||||
"loupe": "^2.3.1",
|
||||
"pathval": "^1.1.1",
|
||||
"type-detect": "^4.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.2.3",
|
||||
"bump-cli": "^1.1.3",
|
||||
"codecov": "^3.0.0",
|
||||
"istanbul": "^0.4.3",
|
||||
"karma": "^6.1.1",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-firefox-launcher": "^1.0.0",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-sauce-launcher": "^1.2.0",
|
||||
"mocha": "^7.1.2"
|
||||
}
|
||||
}
|
1
node_modules/chai/register-assert.js
generated
vendored
Normal file
1
node_modules/chai/register-assert.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
global.assert = require('./').assert;
|
1
node_modules/chai/register-expect.js
generated
vendored
Normal file
1
node_modules/chai/register-expect.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
global.expect = require('./').expect;
|
1
node_modules/chai/register-should.js
generated
vendored
Normal file
1
node_modules/chai/register-should.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
global.should = require('./').should();
|
106
node_modules/chai/sauce.browsers.js
generated
vendored
Normal file
106
node_modules/chai/sauce.browsers.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
|
||||
/*!
|
||||
* Chrome
|
||||
*/
|
||||
|
||||
exports['SL_Chrome'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'chrome'
|
||||
};
|
||||
|
||||
/*!
|
||||
* Firefox
|
||||
*/
|
||||
|
||||
exports['SL_Firefox'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'firefox'
|
||||
};
|
||||
|
||||
exports['SL_Firefox_ESR'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'firefox'
|
||||
, version: 38
|
||||
};
|
||||
|
||||
/*!
|
||||
* Internet Explorer
|
||||
*/
|
||||
|
||||
exports['SL_IE'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'internet explorer'
|
||||
};
|
||||
|
||||
/*!
|
||||
* TODO: fails because of Uint8Array support
|
||||
*
|
||||
exports['SL_IE_Old'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'internet explorer'
|
||||
, version: 10
|
||||
};
|
||||
*/
|
||||
|
||||
exports['SL_Edge'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'microsoftedge'
|
||||
};
|
||||
|
||||
/*!
|
||||
* Safari
|
||||
*/
|
||||
|
||||
exports['SL_Safari'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'safari'
|
||||
, platform: 'Mac 10.11'
|
||||
};
|
||||
|
||||
/*!
|
||||
* iPhone
|
||||
*/
|
||||
|
||||
/*!
|
||||
* TODO: These take forever to boot or shut down. Causes timeout.
|
||||
*
|
||||
|
||||
exports['SL_iPhone_6'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'iphone'
|
||||
, platform: 'Mac 10.8'
|
||||
, version: '6'
|
||||
};
|
||||
|
||||
exports['SL_iPhone_5-1'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'iphone'
|
||||
, platform: 'Mac 10.8'
|
||||
, version: '5.1'
|
||||
};
|
||||
|
||||
exports['SL_iPhone_5'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'iphone'
|
||||
, platform: 'Mac 10.6'
|
||||
, version: '5'
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Android
|
||||
*/
|
||||
|
||||
/*!
|
||||
* TODO: fails because of error serialization
|
||||
*
|
||||
|
||||
exports['SL_Android_4'] = {
|
||||
base: 'SauceLabs'
|
||||
, browserName: 'android'
|
||||
, platform: 'Linux'
|
||||
, version: '4'
|
||||
};
|
||||
|
||||
*/
|
Reference in New Issue
Block a user