Add comprehensive development roadmap via GitHub Issues
Created 10 detailed GitHub issues covering: - Project activation and management UI (#1-2) - Worker node coordination and visualization (#3-4) - Automated GitHub repository scanning (#5) - Intelligent model-to-issue matching (#6) - Multi-model task execution system (#7) - N8N workflow integration (#8) - Hive-Bzzz P2P bridge (#9) - Peer assistance protocol (#10) Each issue includes detailed specifications, acceptance criteria, technical implementation notes, and dependency mapping. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
10
frontend/node_modules/chai/.prettierrc.json
generated
vendored
Normal file
10
frontend/node_modules/chai/.prettierrc.json
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"bracketSpacing": false,
|
||||
"printWidth": 80,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "none",
|
||||
"useTabs": false,
|
||||
"arrowParens": "always"
|
||||
}
|
||||
1
frontend/node_modules/chai/CODEOWNERS
generated
vendored
Normal file
1
frontend/node_modules/chai/CODEOWNERS
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* @chaijs/chai
|
||||
58
frontend/node_modules/chai/CODE_OF_CONDUCT.md
generated
vendored
Normal file
58
frontend/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
frontend/node_modules/chai/CONTRIBUTING.md
generated
vendored
Normal file
218
frontend/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
frontend/node_modules/chai/History.md
generated
vendored
Normal file
1059
frontend/node_modules/chai/History.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
frontend/node_modules/chai/LICENSE
generated
vendored
Normal file
21
frontend/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.
|
||||
154
frontend/node_modules/chai/README.md
generated
vendored
Normal file
154
frontend/node_modules/chai/README.md
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
<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="https://www.npmjs.com/package/chai">
|
||||
<img
|
||||
alt="downloads:?"
|
||||
src="https://img.shields.io/npm/dm/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=18.0-blue.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
|
||||
import { assert } from 'chai'; // Using Assert style
|
||||
import { expect } from 'chai'; // Using Expect style
|
||||
import { should } from 'chai'; // Using Should style
|
||||
```
|
||||
|
||||
### Register 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
|
||||
```
|
||||
|
||||
### Import assertion styles as local variables
|
||||
|
||||
```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`
|
||||
|
||||
import { expect, use } from 'chai'; // Creates local variables `expect` and `use`; useful for plugin use
|
||||
```
|
||||
|
||||
### Usage with Mocha
|
||||
|
||||
```bash
|
||||
mocha spec.js --require chai/register-assert.js # Using Assert style
|
||||
mocha spec.js --require chai/register-expect.js # Using Expect style
|
||||
mocha spec.js --require chai/register-should.js # 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 / 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.
|
||||
|
||||
### 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
frontend/node_modules/chai/ReleaseNotes.md
generated
vendored
Normal file
737
frontend/node_modules/chai/ReleaseNotes.md
generated
vendored
Normal file
@@ -0,0 +1,737 @@
|
||||
# Release Notes
|
||||
|
||||
## Note
|
||||
|
||||
As of 3.0.0, the ReleaseNotes.md file has been deprecated. [Please refer to the release notes available on Github](https://github.com/chaijs/chai/releases). Or
|
||||
[the release notes on the chaijs.com website](https://chaijs.com/releases).
|
||||
|
||||
---
|
||||
|
||||
## 2.3.0 / 2015-04-26
|
||||
|
||||
Added `ownPropertyDescriptor` assertion:
|
||||
|
||||
```js
|
||||
expect('test').to.have.ownPropertyDescriptor('length');
|
||||
expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 });
|
||||
expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 });
|
||||
expect('test').ownPropertyDescriptor('length').to.have.property('enumerable', false);
|
||||
expect('test').ownPropertyDescriptor('length').to.have.keys('value');
|
||||
```
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#408](https://github.com/chaijs/chai/pull/408) Add `ownPropertyDescriptor`
|
||||
assertion.
|
||||
By [@ljharb](https://github.com/ljharb)
|
||||
* [#422](https://github.com/chaijs/chai/pull/422) Improve ownPropertyDescriptor
|
||||
tests.
|
||||
By [@ljharb](https://github.com/ljharb)
|
||||
|
||||
#### Documentation fixes
|
||||
|
||||
* [#417](https://github.com/chaijs/chai/pull/417) Fix documentation typo
|
||||
By [@astorije](https://github.com/astorije)
|
||||
* [#423](https://github.com/chaijs/chai/pull/423) Fix inconsistency in docs.
|
||||
By [@ehntoo](https://github.com/ehntoo)
|
||||
|
||||
|
||||
## 2.2.0 / 2015-03-26
|
||||
|
||||
Deep property strings can now be escaped using `\\` - for example:
|
||||
|
||||
```js
|
||||
var deepCss = { '.link': { '[target]': 42 }};
|
||||
expect(deepCss).to.have.deep.property('\\.link.\\[target\\]', 42)
|
||||
```
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#402](https://github.com/chaijs/chai/pull/402) Allow escaping of deep
|
||||
property keys.
|
||||
By [@umireon](https://github.com/umireon)
|
||||
|
||||
#### Documentation fixes
|
||||
|
||||
* [#405](https://github.com/chaijs/chai/pull/405) Tweak documentation around
|
||||
deep property escaping.
|
||||
By [@keithamus](https://github.com/keithamus)
|
||||
|
||||
|
||||
## 2.1.2 / 2015-03-15
|
||||
|
||||
A minor bug fix. No new features.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#395](https://github.com/chaijs/chai/pull/395) Fix eval-related bugs with
|
||||
assert.operator ([#386](https://github.com/chaijs/chai/pull/386)).
|
||||
By [@cjqed](https://github.com/cjqed)
|
||||
|
||||
## 2.1.1 / 2015-03-04
|
||||
|
||||
Two minor bugfixes. No new features.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#385](https://github.com/chaijs/chai/pull/385) Fix a bug (also described in
|
||||
[#387](https://github.com/chaijs/chai/pull/385)) where `deep.property` would not work with single
|
||||
key names. By [@eldritch-fossicker](https://github.com/eldritch-fossicker)
|
||||
* [#379](https://github.com/chaijs/chai/pull/379) Fix bug where tools which overwrite
|
||||
primitive prototypes, such as Babel or core-js would fail.
|
||||
By [@dcneiner](https://github.com/dcneiner)
|
||||
|
||||
#### Documentation fixes
|
||||
|
||||
* [#382](https://github.com/chaijs/chai/pull/382) Add doc for showDiff argument in assert.
|
||||
By [@astorije](https://github.com/astorije)
|
||||
* [#383](https://github.com/chaijs/chai/pull/383) Improve wording for truncateTreshold docs
|
||||
By [@gurdiga](https://github.com/gurdiga)
|
||||
* [#381](https://github.com/chaijs/chai/pull/381) Improve wording for assert.empty docs
|
||||
By [@astorije](https://github.com/astorije)
|
||||
|
||||
## 2.1.0 / 2015-02-23
|
||||
|
||||
Small release; fixes an issue where the Chai lib was incorrectly reporting the
|
||||
version number.
|
||||
|
||||
Adds new `should.fail()` and `expect.fail()` methods, which are convinience
|
||||
methods to throw Assertion Errors.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#356](https://github.com/chaijs/chai/pull/356) Add should.fail(), expect.fail(). By [@Soviut](https://github.com/Soviut)
|
||||
* [#374](https://github.com/chaijs/chai/pull/374) Increment version. By [@jmm](https://github.com/jmm)
|
||||
|
||||
## 2.0.0 / 2015-02-09
|
||||
|
||||
Unfortunately with 1.10.0 - compatibility broke with older versions because of
|
||||
the `addChainableNoop`. This change has been reverted.
|
||||
|
||||
Any plugins using `addChainableNoop` should cease to do so.
|
||||
|
||||
Any developers wishing for this behaviour can use [dirty-chai](https://www.npmjs.com/package/dirty-chai)
|
||||
by [@joshperry](https://github.com/joshperry)
|
||||
|
||||
### Community Contributions
|
||||
|
||||
#### Code Features & Fixes
|
||||
|
||||
* [#361](https://github.com/chaijs/chai/pull/361) `.keys()` now accepts Objects, extracting keys from them. By [@gregglind](https://github.com/gregglind)
|
||||
* [#359](https://github.com/chaijs/chai/pull/359) `.keys()` no longer mutates passed arrays. By [@gregglind](https://github.com/gregglind)
|
||||
* [#349](https://github.com/chaijs/chai/pull/349) Add a new chainable keyword - `.which`. By [@toastynerd](https://github.com/toastynerd)
|
||||
* [#333](https://github.com/chaijs/chai/pull/333) Add `.change`, `.increase` and `.decrease` assertions. By [@cmpolis](https://github.com/cmpolis)
|
||||
* [#335](https://github.com/chaijs/chai/pull/335) `chai.util` is now exposed [@DingoEatingFuzz](https://github.com/DingoEatingFuzz)
|
||||
* [#328](https://github.com/chaijs/chai/pull/328) Add `.includes` and `.contains` aliases (for `.include` and `.contain`). By [@lo1tuma](https://github.com/lo1tuma)
|
||||
* [#313](https://github.com/chaijs/chai/pull/313) Add `.any.keys()` and `.all.keys()` qualifiers. By [@cjqed](https://github.com/cjqed)
|
||||
* [#312](https://github.com/chaijs/chai/pull/312) Add `assert.sameDeepMembers()`. By [@cjqed](https://github.com/cjqed)
|
||||
* [#311](https://github.com/chaijs/chai/pull/311) Add `assert.isAbove()` and `assert.isBelow()`. By [@cjqed](https://github.com/cjqed)
|
||||
* [#308](https://github.com/chaijs/chai/pull/308) `property` and `deep.property` now pass if a value is set to `undefined`. By [@prodatakey](https://github.com/prodatakey)
|
||||
* [#309](https://github.com/chaijs/chai/pull/309) optimize deep equal in Arrays. By [@ericdouglas](https://github.com/ericdouglas)
|
||||
* [#306](https://github.com/chaijs/chai/pull/306) revert #297 - allowing lint-friendly tests. By [@keithamus](https://github.com/keithamus)
|
||||
|
||||
#### Documentation fixes
|
||||
|
||||
* [#357](https://github.com/chaijs/chai/pull/357) Copyright year updated in docs. By [@danilovaz](https://github.com/danilovaz)
|
||||
* [#325](https://github.com/chaijs/chai/pull/325) Fix documentation for overwriteChainableMethod. By [@chasenlehara](https://github.com/chasenlehara)
|
||||
* [#334](https://github.com/chaijs/chai/pull/334) Typo fix. By [@hurrymaplelad](https://github.com/hurrymaplelad)
|
||||
* [#317](https://github.com/chaijs/chai/pull/317) Typo fix. By [@jasonkarns](https://github.com/jasonkarns)
|
||||
* [#318](https://github.com/chaijs/chai/pull/318) Typo fix. By [@jasonkarns](https://github.com/jasonkarns)
|
||||
* [#316](https://github.com/chaijs/chai/pull/316) Typo fix. By [@jasonkarns](https://github.com/jasonkarns)
|
||||
|
||||
|
||||
## 1.10.0 / 2014-11-10
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required
|
||||
- **Plugin Developers:**
|
||||
- Review `addChainableNoop` notes below.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Noop Function for Terminating Assertion Properties
|
||||
|
||||
The following assertions can now also be used in the function-call form:
|
||||
|
||||
* ok
|
||||
* true
|
||||
* false
|
||||
* null
|
||||
* undefined
|
||||
* exist
|
||||
* empty
|
||||
* arguments
|
||||
* Arguments
|
||||
|
||||
The above list of assertions are property getters that assert immediately on
|
||||
access. Because of that, they were written to be used by terminating the assertion
|
||||
chain with a property access.
|
||||
|
||||
```js
|
||||
expect(true).to.be.true;
|
||||
foo.should.be.ok;
|
||||
```
|
||||
|
||||
This syntax is definitely aesthetically pleasing but, if you are linting your
|
||||
test code, your linter will complain with an error something like "Expected an
|
||||
assignment or function call and instead saw an expression." Since the linter
|
||||
doesn't know about the property getter it assumes this line has no side-effects,
|
||||
and throws a warning in case you made a mistake.
|
||||
|
||||
Squelching these errors is not a good solution as test code is getting to be
|
||||
just as important as, if not more than, production code. Catching syntactical
|
||||
errors in tests using static analysis is a great tool to help make sure that your
|
||||
tests are well-defined and free of typos.
|
||||
|
||||
A better option was to provide a function-call form for these assertions so that
|
||||
the code's intent is more clear and the linters stop complaining about something
|
||||
looking off. This form is added in addition to the existing property access form
|
||||
and does not impact existing test code.
|
||||
|
||||
```js
|
||||
expect(true).to.be.true();
|
||||
foo.should.be.ok();
|
||||
```
|
||||
|
||||
These forms can also be mixed in any way, these are all functionally identical:
|
||||
|
||||
```js
|
||||
expect(true).to.be.true.and.not.false();
|
||||
expect(true).to.be.true().and.not.false;
|
||||
expect(true).to.be.true.and.not.false;
|
||||
```
|
||||
|
||||
#### Plugin Authors
|
||||
|
||||
If you would like to provide this function-call form for your terminating assertion
|
||||
properties, there is a new function to register these types of asserts. Instead
|
||||
of using `addProperty` to register terminating assertions, simply use `addChainableNoop`
|
||||
instead; the arguments to both are identical. The latter will make the assertion
|
||||
available in both the attribute and function-call forms and should have no impact
|
||||
on existing users of your plugin.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#297](https://github.com/chaijs/chai/pull/297) Allow writing lint-friendly tests. [@joshperry](https://github.com/joshperry)
|
||||
- [#298](https://github.com/chaijs/chai/pull/298) Add check for logging `-0`. [@dasilvacontin](https://github.com/dasilvacontin)
|
||||
- [#300](https://github.com/chaijs/chai/pull/300) Fix #299: the test is defining global variables [@julienw](https://github.com/julienw)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
## 1.9.2 / 2014-09-29
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#264](https://github.com/chaijs/chai/pull/264) Show diff for keys assertions [@cjthompson](https://github.com/cjthompson)
|
||||
- [#267](https://github.com/chaijs/chai/pull/267) Use SVG badges [@shinnn](https://github.com/shinnn)
|
||||
- [#268](https://github.com/chaijs/chai/pull/268) Allow messages to be functions (sinon-compat) [@charlierudolph](https://github.com/charlierudolph)
|
||||
- [#269](https://github.com/chaijs/chai/pull/269) Remove unused argument for #lengthOf [@charlierudolph](https://github.com/charlierudolph)
|
||||
- [#275](https://github.com/chaijs/chai/pull/275) Rewrite pretty-printing HTML elements to prevent throwing internal errors [@DrRataplan](https://github.com/DrRataplan)
|
||||
- [#277](https://github.com/chaijs/chai/pull/277) Fix assert documentation for #sameMembers [@charlierudolph](https://github.com/charlierudolph)
|
||||
- [#279](https://github.com/chaijs/chai/pull/279) closeTo should check value's type before assertion [@mohayonao](https://github.com/mohayonao)
|
||||
- [#289](https://github.com/chaijs/chai/pull/289) satisfy is called twice [@charlierudolph](https://github.com/charlierudolph)
|
||||
- [#292](https://github.com/chaijs/chai/pull/292) resolve conflicts with node-webkit and global usage [@boneskull](https://github.com/boneskull)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
## 1.9.1 / 2014-03-19
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- Migrate configuration options to new interface. (see notes)
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Configuration
|
||||
|
||||
There have been requests for changes and additions to the configuration mechanisms
|
||||
and their impact in the Chai architecture. As such, we have decoupled the
|
||||
configuration from the `Assertion` constructor. This not only allows for centralized
|
||||
configuration, but will allow us to shift the responsibility from the `Assertion`
|
||||
constructor to the `assert` interface in future releases.
|
||||
|
||||
These changes have been implemented in a non-breaking way, but a depretiation
|
||||
warning will be presented to users until they migrate. The old config method will
|
||||
be removed in either `v1.11.0` or `v2.0.0`, whichever comes first.
|
||||
|
||||
#### Quick Migration
|
||||
|
||||
```js
|
||||
// change this:
|
||||
chai.Assertion.includeStack = true;
|
||||
chai.Assertion.showDiff = false;
|
||||
|
||||
// ... to this:
|
||||
chai.config.includeStack = true;
|
||||
chai.config.showDiff = false;
|
||||
```
|
||||
|
||||
#### All Config Options
|
||||
|
||||
##### config.includeStack
|
||||
|
||||
- **@param** _{Boolean}_
|
||||
- **@default** `false`
|
||||
|
||||
User configurable property, influences whether stack trace is included in
|
||||
Assertion error message. Default of `false` suppresses stack trace in the error
|
||||
message.
|
||||
|
||||
##### config.showDiff
|
||||
|
||||
- **@param** _{Boolean}_
|
||||
- **@default** `true`
|
||||
|
||||
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.
|
||||
|
||||
##### config.truncateThreshold **(NEW)**
|
||||
|
||||
- **@param** _{Number}_
|
||||
- **@default** `40`
|
||||
|
||||
User configurable property, sets length threshold for actual and expected values
|
||||
in assertion errors. If this threshold is exceeded, the value is truncated.
|
||||
|
||||
Set it to zero if you want to disable truncating altogether.
|
||||
|
||||
```js
|
||||
chai.config.truncateThreshold = 0; // disable truncating
|
||||
```
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#228](https://github.com/chaijs/chai/pull/228) Deep equality check for memebers. [@duncanbeevers](https://github.com/duncanbeevers)
|
||||
- [#247](https://github.com/chaijs/chai/pull/247) Proofreading. [@didorellano](https://github.com/didoarellano)
|
||||
- [#244](https://github.com/chaijs/chai/pull/244) Fix `contain`/`include` 1.9.0 regression. [@leider](https://github.com/leider)
|
||||
- [#233](https://github.com/chaijs/chai/pull/233) Improvements to `ssfi` for `assert` interface. [@refack](https://github.com/refack)
|
||||
- [#251](https://github.com/chaijs/chai/pull/251) New config option: object display threshold. [@romario333](https://github.com/romario333)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
### Other Bug Fixes
|
||||
|
||||
- [#183](https://github.com/chaijs/chai/issues/183) Allow `undefined` for actual. (internal api)
|
||||
- Update Karam(+plugins)/Istanbul to most recent versions.
|
||||
|
||||
## 1.9.0 / 2014-01-29
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required
|
||||
- **Plugin Developers:**
|
||||
- Review [#219](https://github.com/chaijs/chai/pull/219).
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#202](https://github.com/chaijs/chai/pull/201) Improve error message for .throw(). [@andreineculau](https://github.com/andreineculau)
|
||||
- [#217](https://github.com/chaijs/chai/pull/217) Chai tests can be run with `--watch`. [@demands](https://github.com/demands)
|
||||
- [#219](https://github.com/chaijs/chai/pull/219) Add overwriteChainableMethod utility. [@demands](https://github.com/demands)
|
||||
- [#224](https://github.com/chaijs/chai/pull/224) Return error on throw method to chain on error properties. [@vbardales](https://github.com/vbardales)
|
||||
- [#226](https://github.com/chaijs/chai/pull/226) Add `has` to language chains. [@duncanbeevers](https://github.com/duncanbeevers)
|
||||
- [#230](https://github.com/chaijs/chai/pull/230) Support `{a:1,b:2}.should.include({a:1})` [@jkroso](https://github.com/jkroso)
|
||||
- [#231](https://github.com/chaijs/chai/pull/231) Update Copyright notices to 2014 [@duncanbeevers](https://github.com/duncanbeevers)
|
||||
- [#232](https://github.com/chaijs/chai/pull/232) Avoid error instantiation if possible on assert.throws. [@laconbass](https://github.com/laconbass)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
### Other Bug Fixes
|
||||
|
||||
- [#225](https://github.com/chaijs/chai/pull/225) Improved AMD wrapper provided by upstream `component(1)`.
|
||||
- [#185](https://github.com/chaijs/chai/issues/185) `assert.throws()` returns thrown error for further assertions.
|
||||
- [#237](https://github.com/chaijs/chai/pull/237) Remove coveralls/jscoverage, include istanbul coverage report in travis test.
|
||||
- Update Karma and Sauce runner versions for consistent CI results. No more karma@canary.
|
||||
|
||||
## 1.8.1 / 2013-10-10
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Browserify
|
||||
|
||||
This is a small patch that updates the dependency tree so browserify users can install
|
||||
chai. (Remove conditional requires)
|
||||
|
||||
## 1.8.0 / 2013-09-18
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- See `deep.equal` notes.
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Deep Equals
|
||||
|
||||
This version of Chai focused on a overhaul to the deep equal utility. The code for this
|
||||
tool has been removed from the core lib and can now be found at:
|
||||
[chai / deep-eql](https://github.com/chaijs/deep-eql). As stated in previous releases,
|
||||
this is part of a larger initiative to provide transparency, independent testing, and coverage for
|
||||
some of the more complicated internal tools.
|
||||
|
||||
For the most part `.deep.equal` will behave the same as it has. However, in order to provide a
|
||||
consistent ruleset across all types being tested, the following changes have been made and _might_
|
||||
require changes to your tests.
|
||||
|
||||
**1.** Strict equality for non-traversable nodes according to [egal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
||||
|
||||
_Previously:_ Non-traversable equal via `===`.
|
||||
|
||||
```js
|
||||
expect(NaN).to.deep.equal(NaN);
|
||||
expect(-0).to.not.deep.equal(+0);
|
||||
```
|
||||
|
||||
**2.** Arguments are not Arrays (and all types must be equal):
|
||||
|
||||
_Previously:_ Some crazy nonsense that led to empty arrays deep equaling empty objects deep equaling dates.
|
||||
|
||||
```js
|
||||
expect(arguments).to.not.deep.equal([]);
|
||||
expect(Array.prototype.slice.call(arguments)).to.deep.equal([]);
|
||||
```
|
||||
|
||||
- [#156](https://github.com/chaijs/chai/issues/156) Empty object is eql to empty array
|
||||
- [#192](https://github.com/chaijs/chai/issues/192) empty object is eql to a Date object
|
||||
- [#194](https://github.com/chaijs/chai/issues/194) refactor deep-equal utility
|
||||
|
||||
### CI and Browser Testing
|
||||
|
||||
Chai now runs the browser CI suite using [Karma](http://karma-runner.github.io/) directed at
|
||||
[SauceLabs](https://saucelabs.com/). This means we get to know where our browser support stands...
|
||||
and we get a cool badge:
|
||||
|
||||
[](https://saucelabs.com/u/logicalparadox)
|
||||
|
||||
Look for the list of browsers/versions to expand over the coming releases.
|
||||
|
||||
- [#195](https://github.com/chaijs/chai/issues/195) karma test framework
|
||||
|
||||
## 1.7.2 / 2013-06-27
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Coverage Reporting
|
||||
|
||||
Coverage reporting has always been available for core-developers but the data has never been published
|
||||
for our end users. In our ongoing effort to improve accountability this data will now be published via
|
||||
the [coveralls.io](https://coveralls.io/) service. A badge has been added to the README and the full report
|
||||
can be viewed online at the [chai coveralls project](https://coveralls.io/r/chaijs/chai). Furthermore, PRs
|
||||
will receive automated messages indicating how their PR impacts test coverage. This service is tied to TravisCI.
|
||||
|
||||
### Other Fixes
|
||||
|
||||
- [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`. (Fix ignore all)
|
||||
|
||||
## 1.7.1 / 2013-06-24
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- No changes required
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### Official Bower Support
|
||||
|
||||
Support has been added for the Bower Package Manager ([bower.io])(http://bower.io/). Though
|
||||
Chai could be installed via Bower in the past, this update adds official support via the `bower.json`
|
||||
specification file.
|
||||
|
||||
- [#175](https://github.com/chaijs/chai/issues/175) Add `bower.json`.
|
||||
|
||||
## 1.7.0 / 2013-06-17
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- Review AssertionError update notice.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated dependencies.
|
||||
|
||||
### AssertionError Update Notice
|
||||
|
||||
Chai now uses [chaijs/assertion-error](https://github.com/chaijs/assertion-error) instead an internal
|
||||
constructor. This will allow for further iteration/experimentation of the AssertionError constructor
|
||||
independant of Chai. Future plans include stack parsing for callsite support.
|
||||
|
||||
This update constructor has a different constructor param signature that conforms more with the standard
|
||||
`Error` object. If your plugin throws and `AssertionError` directly you will need to update your plugin
|
||||
with the new signature.
|
||||
|
||||
```js
|
||||
var AssertionError = require('chai').AssertionError;
|
||||
|
||||
/**
|
||||
* previous
|
||||
*
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
||||
throw new AssertionError({
|
||||
message: 'An assertion error occurred'
|
||||
, actual: actual
|
||||
, expect: expect
|
||||
, startStackFunction: arguments.callee
|
||||
, showStack: true
|
||||
});
|
||||
|
||||
/**
|
||||
* new
|
||||
*
|
||||
* @param {String} message
|
||||
* @param {Object} options
|
||||
* @param {Function} start stack function
|
||||
*/
|
||||
|
||||
throw new AssertionError('An assertion error occurred', {
|
||||
actual: actual
|
||||
, expect: expect
|
||||
, showStack: true
|
||||
}, arguments.callee);
|
||||
|
||||
// other signatures
|
||||
throw new AssertionError('An assertion error occurred');
|
||||
throw new AssertionError('An assertion error occurred', null, arguments.callee);
|
||||
```
|
||||
|
||||
#### External Dependencies
|
||||
|
||||
This is the first non-developement dependency for Chai. As Chai continues to evolve we will begin adding
|
||||
more; the next will likely be improved type detection and deep equality. With Chai's userbase continually growing
|
||||
there is an higher need for accountability and documentation. External dependencies will allow us to iterate and
|
||||
test on features independent from our interfaces.
|
||||
|
||||
Note: The browser packaged version `chai.js` will ALWAYS contain all dependencies needed to run Chai.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#169](https://github.com/chaijs/chai/pull/169) Fix deep equal comparison for Date/Regexp types. [@katsgeorgeek](https://github.com/katsgeorgeek)
|
||||
- [#171](https://github.com/chaijs/chai/pull/171) Add `assert.notOk()`. [@Bartvds](https://github.com/Bartvds)
|
||||
- [#173](https://github.com/chaijs/chai/pull/173) Fix `inspect` utility. [@domenic](https://github.com/domenic)
|
||||
|
||||
Thank you to all who took the time to contribute!
|
||||
|
||||
## 1.6.1 / 2013-06-05
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- No changes required.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated developement dependencies.
|
||||
|
||||
### Deep Equality
|
||||
|
||||
Regular Expressions are now tested as part of all deep equality assertions. In previous versions
|
||||
they silently passed for all scenarios. Thanks to [@katsgeorgeek](https://github.com/katsgeorgeek) for the contribution.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#161](https://github.com/chaijs/chai/pull/161) Fix documented name for assert interface's isDefined method. [@brandonpayton](https://github.com/brandonpayton)
|
||||
- [#168](https://github.com/chaijs/chai/pull/168) Fix comparison equality of two regexps for when using deep equality. [@katsgeorgeek](https://github.com/katsgeorgeek)
|
||||
|
||||
Thank you to all who took the time to contribute!
|
||||
|
||||
### Additional Notes
|
||||
|
||||
- Mocha has been locked at version `1.8.x` to ensure `mocha-phantomjs` compatibility.
|
||||
|
||||
## 1.6.0 / 2013-04-29
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- No changes required.
|
||||
- **Plugin Developers:**
|
||||
- No changes required.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated developement dependencies.
|
||||
|
||||
### New Assertions
|
||||
|
||||
#### Array Members Inclusion
|
||||
|
||||
Asserts that the target is a superset of `set`, or that the target and `set` have the same members.
|
||||
Order is not taken into account. Thanks to [@NickHeiner](https://github.com/NickHeiner) for the contribution.
|
||||
|
||||
```js
|
||||
// (expect/should) full set
|
||||
expect([4, 2]).to.have.members([2, 4]);
|
||||
expect([5, 2]).to.not.have.members([5, 2, 1]);
|
||||
|
||||
// (expect/should) inclusion
|
||||
expect([1, 2, 3]).to.include.members([3, 2]);
|
||||
expect([1, 2, 3]).to.not.include.members([3, 2, 8]);
|
||||
|
||||
// (assert) full set
|
||||
assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
|
||||
|
||||
// (assert) inclusion
|
||||
assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members');
|
||||
|
||||
```
|
||||
|
||||
#### Non-inclusion for Assert Interface
|
||||
|
||||
Most `assert` functions have a negative version, like `instanceOf()` has a corresponding `notInstaceOf()`.
|
||||
However `include()` did not have a corresponding `notInclude()`. This has been added.
|
||||
|
||||
```js
|
||||
assert.notInclude([ 1, 2, 3 ], 8);
|
||||
assert.notInclude('foobar', 'baz');
|
||||
```
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#140](https://github.com/chaijs/chai/pull/140) Restore `call`/`apply` methods for plugin interface. [@RubenVerborgh](https://github.com/RubenVerborgh)
|
||||
- [#148](https://github.com/chaijs/chai/issues/148)/[#153](https://github.com/chaijs/chai/pull/153) Add `members` and `include.members` assertions. [#NickHeiner](https://github.com/NickHeiner)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
### Other Bug Fixes
|
||||
|
||||
- [#142](https://github.com/chaijs/chai/issues/142) `assert#include` will no longer silently pass on wrong-type haystack.
|
||||
- [#158](https://github.com/chaijs/chai/issues/158) `assert#notInclude` has been added.
|
||||
- Travis-CI now tests Node.js `v0.10.x`. Support for `v0.6.x` has been removed. `v0.8.x` is still tested as before.
|
||||
|
||||
## 1.5.0 / 2013-02-03
|
||||
|
||||
### Migration Requirements
|
||||
|
||||
The following changes are required if you are upgrading from the previous version:
|
||||
|
||||
- **Users:**
|
||||
- _Update [2013-02-04]:_ Some users may notice a small subset of deep equality assertions will no longer pass. This is the result of
|
||||
[#120](https://github.com/chaijs/chai/issues/120), an improvement to our deep equality algorithm. Users will need to revise their assertions
|
||||
to be more granular should this occur. Further information: [#139](https://github.com/chaijs/chai/issues/139).
|
||||
- **Plugin Developers:**
|
||||
- No changes required.
|
||||
- **Core Contributors:**
|
||||
- Refresh `node_modules` folder for updated developement dependencies.
|
||||
|
||||
### Community Contributions
|
||||
|
||||
- [#126](https://github.com/chaijs/chai/pull/126): Add `eqls` alias for `eql`. [@RubenVerborgh](https://github.com/RubenVerborgh)
|
||||
- [#127](https://github.com/chaijs/chai/issues/127): Performance refactor for chainable methods. [@RubenVerborgh](https://github.com/RubenVerborgh)
|
||||
- [#133](https://github.com/chaijs/chai/pull/133): Assertion `.throw` support for primitives. [@RubenVerborgh](https://github.com/RubenVerborgh)
|
||||
- [#137](https://github.com/chaijs/chai/issues/137): Assertion `.throw` support for empty messages. [@timnew](https://github.com/timnew)
|
||||
- [#136](https://github.com/chaijs/chai/pull/136): Fix backward negation messages when using `.above()` and `.below()`. [@whatthejeff](https://github.com/whatthejeff)
|
||||
|
||||
Thank you to all who took time to contribute!
|
||||
|
||||
### Other Bug Fixes
|
||||
|
||||
- Improve type detection of `.a()`/`.an()` to work in cross-browser scenarios.
|
||||
- [#116](https://github.com/chaijs/chai/issues/116): `.throw()` has cleaner display of errors when WebKit browsers.
|
||||
- [#120](https://github.com/chaijs/chai/issues/120): `.eql()` now works to compare dom nodes in browsers.
|
||||
|
||||
|
||||
### Usage Updates
|
||||
|
||||
#### For Users
|
||||
|
||||
**1. Component Support:** Chai now included the proper configuration to be installed as a
|
||||
[component](https://github.com/component/component). Component users are encouraged to consult
|
||||
[chaijs.com](http://chaijs.com) for the latest version number as using the master branch
|
||||
does not gaurantee stability.
|
||||
|
||||
```js
|
||||
// relevant component.json
|
||||
devDependencies: {
|
||||
"chaijs/chai": "1.5.0"
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively, bleeding-edge is available:
|
||||
|
||||
$ component install chaijs/chai
|
||||
|
||||
**2. Configurable showDiff:** Some test runners (such as [mocha](http://visionmedia.github.com/mocha/))
|
||||
include support for showing the diff of strings and objects when an equality error occurs. Chai has
|
||||
already included support for this, however some users may not prefer this display behavior. To revert to
|
||||
no diff display, the following configuration is available:
|
||||
|
||||
```js
|
||||
chai.Assertion.showDiff = false; // diff output disabled
|
||||
chai.Assertion.showDiff = true; // default, diff output enabled
|
||||
```
|
||||
|
||||
#### For Plugin Developers
|
||||
|
||||
**1. New Utility - type**: The new utility `.type()` is available as a better implementation of `typeof`
|
||||
that can be used cross-browser. It handles the inconsistencies of Array, `null`, and `undefined` detection.
|
||||
|
||||
- **@param** _{Mixed}_ object to detect type of
|
||||
- **@return** _{String}_ object type
|
||||
|
||||
```js
|
||||
chai.use(function (c, utils) {
|
||||
// some examples
|
||||
utils.type({}); // 'object'
|
||||
utils.type(null); // `null'
|
||||
utils.type(undefined); // `undefined`
|
||||
utils.type([]); // `array`
|
||||
});
|
||||
```
|
||||
|
||||
#### For Core Contributors
|
||||
|
||||
**1. Browser Testing**: Browser testing of the `./chai.js` file is now available in the command line
|
||||
via PhantomJS. `make test` and Travis-CI will now also rebuild and test `./chai.js`. Consequently, all
|
||||
pull requests will now be browser tested in this way.
|
||||
|
||||
_Note: Contributors opening pull requests should still NOT include the browser build._
|
||||
|
||||
**2. SauceLabs Testing**: Early SauceLab support has been enabled with the file `./support/mocha-cloud.js`.
|
||||
Those interested in trying it out should create a free [Open Sauce](https://saucelabs.com/signup/plan) account
|
||||
and include their credentials in `./test/auth/sauce.json`.
|
||||
4401
frontend/node_modules/chai/chai.js
generated
vendored
Normal file
4401
frontend/node_modules/chai/chai.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
27
frontend/node_modules/chai/eslint.config.js
generated
vendored
Normal file
27
frontend/node_modules/chai/eslint.config.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import jsdoc from "eslint-plugin-jsdoc";
|
||||
import eslintjs from "@eslint/js";
|
||||
|
||||
const {configs: eslintConfigs} = eslintjs;
|
||||
|
||||
export default [
|
||||
jsdoc.configs["flat/recommended"],
|
||||
eslintConfigs["recommended"],
|
||||
{
|
||||
languageOptions: {
|
||||
// if we ever use more globals than this, pull in the `globals` package
|
||||
globals: {
|
||||
console: false
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
"no-var": "error",
|
||||
"jsdoc/require-param-description": "off",
|
||||
"jsdoc/require-returns-description": "off",
|
||||
"jsdoc/tag-lines": ["error", "any", { startLines: 1 }],
|
||||
"no-unused-vars": ["error", {
|
||||
argsIgnorePattern: "^_",
|
||||
caughtErrorsIgnorePattern: "^_"
|
||||
}]
|
||||
},
|
||||
},
|
||||
];
|
||||
1
frontend/node_modules/chai/index.js
generated
vendored
Normal file
1
frontend/node_modules/chai/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/chai.js';
|
||||
66
frontend/node_modules/chai/lib/chai.js
generated
vendored
Normal file
66
frontend/node_modules/chai/lib/chai.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import * as util from './chai/utils/index.js';
|
||||
import {AssertionError} from 'assertion-error';
|
||||
import {config} from './chai/config.js';
|
||||
import './chai/core/assertions.js';
|
||||
import {expect} from './chai/interface/expect.js';
|
||||
import {Assertion} from './chai/assertion.js';
|
||||
import * as should from './chai/interface/should.js';
|
||||
import {assert} from './chai/interface/assert.js';
|
||||
|
||||
const used = [];
|
||||
|
||||
// Assertion Error
|
||||
export {AssertionError};
|
||||
|
||||
/**
|
||||
* # .use(function)
|
||||
*
|
||||
* Provides a way to extend the internals of Chai.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @returns {this} for chaining
|
||||
* @public
|
||||
*/
|
||||
export function use(fn) {
|
||||
const exports = {
|
||||
use,
|
||||
AssertionError,
|
||||
util,
|
||||
config,
|
||||
expect,
|
||||
assert,
|
||||
Assertion,
|
||||
...should
|
||||
};
|
||||
|
||||
if (!~used.indexOf(fn)) {
|
||||
fn(exports, util);
|
||||
used.push(fn);
|
||||
}
|
||||
|
||||
return exports;
|
||||
}
|
||||
|
||||
// Utility Functions
|
||||
export {util};
|
||||
|
||||
// Configuration
|
||||
export {config};
|
||||
|
||||
// Primary `Assertion` prototype
|
||||
export * from './chai/assertion.js';
|
||||
|
||||
// Expect interface
|
||||
export * from './chai/interface/expect.js';
|
||||
|
||||
// Should interface
|
||||
export * from './chai/interface/should.js';
|
||||
|
||||
// Assert interface
|
||||
export * from './chai/interface/assert.js';
|
||||
204
frontend/node_modules/chai/lib/chai/assertion.js
generated
vendored
Normal file
204
frontend/node_modules/chai/lib/chai/assertion.js
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
/*!
|
||||
* chai
|
||||
* http://chaijs.com
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {config} from './config.js';
|
||||
import {AssertionError} from 'assertion-error';
|
||||
import * as util from './utils/index.js';
|
||||
|
||||
export class Assertion {
|
||||
/** @type {{}} */
|
||||
__flags = {};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* - `eql`: This flag contains the deepEqual function to be used by the assertion.
|
||||
*
|
||||
* @param {unknown} 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
|
||||
*/
|
||||
constructor(obj, msg, ssfi, lockSsfi) {
|
||||
util.flag(this, 'ssfi', ssfi || Assertion);
|
||||
util.flag(this, 'lockSsfi', lockSsfi);
|
||||
util.flag(this, 'object', obj);
|
||||
util.flag(this, 'message', msg);
|
||||
util.flag(this, 'eql', config.deepEqual || util.eql);
|
||||
|
||||
return util.proxify(this);
|
||||
}
|
||||
|
||||
/** @returns {boolean} */
|
||||
static get includeStack() {
|
||||
console.warn(
|
||||
'Assertion.includeStack is deprecated, use chai.config.includeStack instead.'
|
||||
);
|
||||
return config.includeStack;
|
||||
}
|
||||
|
||||
/** @param {boolean} value */
|
||||
static set includeStack(value) {
|
||||
console.warn(
|
||||
'Assertion.includeStack is deprecated, use chai.config.includeStack instead.'
|
||||
);
|
||||
config.includeStack = value;
|
||||
}
|
||||
|
||||
/** @returns {boolean} */
|
||||
static get showDiff() {
|
||||
console.warn(
|
||||
'Assertion.showDiff is deprecated, use chai.config.showDiff instead.'
|
||||
);
|
||||
return config.showDiff;
|
||||
}
|
||||
|
||||
/** @param {boolean} value */
|
||||
static set showDiff(value) {
|
||||
console.warn(
|
||||
'Assertion.showDiff is deprecated, use chai.config.showDiff instead.'
|
||||
);
|
||||
config.showDiff = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
*/
|
||||
static addProperty(name, fn) {
|
||||
util.addProperty(this.prototype, name, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
*/
|
||||
static addMethod(name, fn) {
|
||||
util.addMethod(this.prototype, name, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
* @param {Function} chainingBehavior
|
||||
*/
|
||||
static addChainableMethod(name, fn, chainingBehavior) {
|
||||
util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
*/
|
||||
static overwriteProperty(name, fn) {
|
||||
util.overwriteProperty(this.prototype, name, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
*/
|
||||
static overwriteMethod(name, fn) {
|
||||
util.overwriteMethod(this.prototype, name, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {Function} fn
|
||||
* @param {Function} chainingBehavior
|
||||
*/
|
||||
static overwriteChainableMethod(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 {unknown} _expr to be tested
|
||||
* @param {string | Function} msg or function that returns message to display if expression fails
|
||||
* @param {string | Function} _negateMsg or function that returns negatedMessage to display if negated expression fails
|
||||
* @param {unknown} expected value (remember to check for negation)
|
||||
* @param {unknown} _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
|
||||
* @returns {void}
|
||||
*/
|
||||
assert(_expr, msg, _negateMsg, expected, _actual, showDiff) {
|
||||
const 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);
|
||||
const actual = util.getActual(this, arguments);
|
||||
/** @type {Record<PropertyKey, unknown>} */
|
||||
const assertionErrorObjectProperties = {
|
||||
actual: actual,
|
||||
expected: expected,
|
||||
showDiff: showDiff
|
||||
};
|
||||
|
||||
const operator = util.getOperator(this, arguments);
|
||||
if (operator) {
|
||||
assertionErrorObjectProperties.operator = operator;
|
||||
}
|
||||
|
||||
throw new AssertionError(
|
||||
msg,
|
||||
assertionErrorObjectProperties,
|
||||
// @ts-expect-error Not sure what to do about these types yet
|
||||
config.includeStack ? this.assert : util.flag(this, 'ssfi')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick reference to stored `actual` value for plugin developers.
|
||||
*
|
||||
* @returns {unknown}
|
||||
*/
|
||||
get _obj() {
|
||||
return util.flag(this, 'object');
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick reference to stored `actual` value for plugin developers.
|
||||
*
|
||||
* @param {unknown} val
|
||||
*/
|
||||
set _obj(val) {
|
||||
util.flag(this, 'object', val);
|
||||
}
|
||||
}
|
||||
112
frontend/node_modules/chai/lib/chai/config.js
generated
vendored
Normal file
112
frontend/node_modules/chai/lib/chai/config.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
export const config = {
|
||||
/**
|
||||
* ### 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}
|
||||
* @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}
|
||||
* @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}
|
||||
* @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}
|
||||
* @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}
|
||||
* @public
|
||||
*/
|
||||
proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'],
|
||||
|
||||
/**
|
||||
* ### config.deepEqual
|
||||
*
|
||||
* User configurable property, defines which a custom function to use for deepEqual
|
||||
* comparisons.
|
||||
* By default, the function used is the one from the `deep-eql` package without custom comparator.
|
||||
*
|
||||
* // use a custom comparator
|
||||
* chai.config.deepEqual = (expected, actual) => {
|
||||
* return chai.util.eql(expected, actual, {
|
||||
* comparator: (expected, actual) => {
|
||||
* // for non number comparison, use the default behavior
|
||||
* if(typeof expected !== 'number') return null;
|
||||
* // allow a difference of 10 between compared numbers
|
||||
* return typeof actual === 'number' && Math.abs(actual - expected) < 10
|
||||
* }
|
||||
* })
|
||||
* };
|
||||
*
|
||||
* @param {Function}
|
||||
* @public
|
||||
*/
|
||||
deepEqual: null
|
||||
};
|
||||
4156
frontend/node_modules/chai/lib/chai/core/assertions.js
generated
vendored
Normal file
4156
frontend/node_modules/chai/lib/chai/core/assertions.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3228
frontend/node_modules/chai/lib/chai/interface/assert.js
generated
vendored
Normal file
3228
frontend/node_modules/chai/lib/chai/interface/assert.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
59
frontend/node_modules/chai/lib/chai/interface/expect.js
generated
vendored
Normal file
59
frontend/node_modules/chai/lib/chai/interface/expect.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import * as chai from '../../../index.js';
|
||||
import {Assertion} from '../assertion.js';
|
||||
import {AssertionError} from 'assertion-error';
|
||||
|
||||
/**
|
||||
* @param {unknown} val
|
||||
* @param {string} message
|
||||
* @returns {Assertion}
|
||||
*/
|
||||
function expect(val, message) {
|
||||
return new Assertion(val, message);
|
||||
}
|
||||
|
||||
export {expect};
|
||||
|
||||
/**
|
||||
* ### .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 {unknown} actual
|
||||
* @param {unknown} expected
|
||||
* @param {string} message
|
||||
* @param {string} operator
|
||||
* @namespace expect
|
||||
* @public
|
||||
*/
|
||||
expect.fail = function (actual, expected, message, operator) {
|
||||
if (arguments.length < 2) {
|
||||
message = actual;
|
||||
actual = undefined;
|
||||
}
|
||||
|
||||
message = message || 'expect.fail()';
|
||||
throw new AssertionError(
|
||||
message,
|
||||
{
|
||||
actual: actual,
|
||||
expected: expected,
|
||||
operator: operator
|
||||
},
|
||||
chai.expect.fail
|
||||
);
|
||||
};
|
||||
227
frontend/node_modules/chai/lib/chai/interface/should.js
generated
vendored
Normal file
227
frontend/node_modules/chai/lib/chai/interface/should.js
generated
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {Assertion} from '../assertion.js';
|
||||
import {AssertionError} from 'assertion-error';
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
function loadShould() {
|
||||
// explicitly define this method as function as to have it's name to include as `ssfi`
|
||||
/**
|
||||
* @returns {Assertion}
|
||||
*/
|
||||
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);
|
||||
}
|
||||
/**
|
||||
* @param {unknown} value
|
||||
*/
|
||||
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
|
||||
});
|
||||
|
||||
let 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 {unknown} actual
|
||||
* @param {unknown} expected
|
||||
* @param {string} message
|
||||
* @param {string} operator
|
||||
* @namespace BDD
|
||||
* @public
|
||||
*/
|
||||
should.fail = function (actual, expected, message, operator) {
|
||||
if (arguments.length < 2) {
|
||||
message = actual;
|
||||
actual = undefined;
|
||||
}
|
||||
|
||||
message = message || 'should.fail()';
|
||||
throw new 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 {unknown} actual
|
||||
* @param {unknown} expected
|
||||
* @param {string} message
|
||||
* @namespace Should
|
||||
* @public
|
||||
*/
|
||||
should.equal = function (actual, expected, message) {
|
||||
new Assertion(actual, message).to.equal(expected);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .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} fn
|
||||
* @param {Error} errt
|
||||
* @param {RegExp} errs
|
||||
* @param {string} msg
|
||||
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
||||
* @namespace Should
|
||||
* @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');
|
||||
*
|
||||
* @param {unknown} val
|
||||
* @param {string} msg
|
||||
* @name exist
|
||||
* @namespace Should
|
||||
* @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 {unknown} actual
|
||||
* @param {unknown} expected
|
||||
* @param {string} msg
|
||||
* @namespace Should
|
||||
* @public
|
||||
*/
|
||||
should.not.equal = function (actual, expected, msg) {
|
||||
new Assertion(actual, msg).to.not.equal(expected);
|
||||
};
|
||||
|
||||
/**
|
||||
* ### .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} fn
|
||||
* @param {Error} errt
|
||||
* @param {RegExp} errs
|
||||
* @param {string} msg
|
||||
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
||||
* @namespace Should
|
||||
* @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');
|
||||
*
|
||||
* @namespace Should
|
||||
* @name not.exist
|
||||
* @param {unknown} val
|
||||
* @param {string} msg
|
||||
* @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;
|
||||
}
|
||||
|
||||
export const should = loadShould;
|
||||
export const Should = loadShould;
|
||||
146
frontend/node_modules/chai/lib/chai/utils/addChainableMethod.js
generated
vendored
Normal file
146
frontend/node_modules/chai/lib/chai/utils/addChainableMethod.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
/*!
|
||||
* Chai - addChainingMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {Assertion} from '../assertion.js';
|
||||
import {addLengthGuard} from './addLengthGuard.js';
|
||||
import {flag} from './flag.js';
|
||||
import {proxify} from './proxify.js';
|
||||
import {transferFlags} from './transferFlags.js';
|
||||
|
||||
/**
|
||||
* Module variables
|
||||
*/
|
||||
|
||||
// Check whether `Object.setPrototypeOf` is supported
|
||||
let 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.
|
||||
let testFn = function () {};
|
||||
let excludeNames = Object.getOwnPropertyNames(testFn).filter(function (name) {
|
||||
let 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
|
||||
let 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
|
||||
* @public
|
||||
*/
|
||||
export function addChainableMethod(ctx, name, method, chainingBehavior) {
|
||||
if (typeof chainingBehavior !== 'function') {
|
||||
chainingBehavior = function () {};
|
||||
}
|
||||
|
||||
let 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);
|
||||
|
||||
let 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);
|
||||
}
|
||||
|
||||
let result = chainableBehavior.method.apply(this, arguments);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
let newAssertion = new 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
|
||||
let 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 {
|
||||
let asserterNames = Object.getOwnPropertyNames(ctx);
|
||||
asserterNames.forEach(function (asserterName) {
|
||||
if (excludeNames.indexOf(asserterName) !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
||||
Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
||||
});
|
||||
}
|
||||
|
||||
transferFlags(this, chainableMethodWrapper);
|
||||
return proxify(chainableMethodWrapper);
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
73
frontend/node_modules/chai/lib/chai/utils/addLengthGuard.js
generated
vendored
Normal file
73
frontend/node_modules/chai/lib/chai/utils/addLengthGuard.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
const 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
|
||||
* @returns {unknown}
|
||||
* @namespace Utils
|
||||
* @name addLengthGuard
|
||||
*/
|
||||
export 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;
|
||||
}
|
||||
66
frontend/node_modules/chai/lib/chai/utils/addMethod.js
generated
vendored
Normal file
66
frontend/node_modules/chai/lib/chai/utils/addMethod.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/*!
|
||||
* Chai - addMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {addLengthGuard} from './addLengthGuard.js';
|
||||
import {flag} from './flag.js';
|
||||
import {proxify} from './proxify.js';
|
||||
import {transferFlags} from './transferFlags.js';
|
||||
import {Assertion} from '../assertion.js';
|
||||
|
||||
/**
|
||||
* ### .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
|
||||
* @public
|
||||
*/
|
||||
export function addMethod(ctx, name, method) {
|
||||
let 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);
|
||||
}
|
||||
|
||||
let result = method.apply(this, arguments);
|
||||
if (result !== undefined) return result;
|
||||
|
||||
let newAssertion = new Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
|
||||
addLengthGuard(methodWrapper, name, false);
|
||||
ctx[name] = proxify(methodWrapper, name);
|
||||
}
|
||||
70
frontend/node_modules/chai/lib/chai/utils/addProperty.js
generated
vendored
Normal file
70
frontend/node_modules/chai/lib/chai/utils/addProperty.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*!
|
||||
* Chai - addProperty utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {Assertion} from '../assertion.js';
|
||||
import {flag} from './flag.js';
|
||||
import {isProxyEnabled} from './isProxyEnabled.js';
|
||||
import {transferFlags} from './transferFlags.js';
|
||||
|
||||
/**
|
||||
* ### .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
|
||||
* @public
|
||||
*/
|
||||
export 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);
|
||||
}
|
||||
|
||||
let result = getter.call(this);
|
||||
if (result !== undefined) return result;
|
||||
|
||||
let newAssertion = new Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
26
frontend/node_modules/chai/lib/chai/utils/compareByInspect.js
generated
vendored
Normal file
26
frontend/node_modules/chai/lib/chai/utils/compareByInspect.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Chai - compareByInspect utility
|
||||
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {inspect} from './inspect.js';
|
||||
|
||||
/**
|
||||
* ### .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 {unknown} a first element to compare
|
||||
* @param {unknown} b second element to compare
|
||||
* @returns {number} -1 if 'a' should come before 'b'; otherwise 1
|
||||
* @name compareByInspect
|
||||
* @namespace Utils
|
||||
* @public
|
||||
*/
|
||||
export function compareByInspect(a, b) {
|
||||
return inspect(a) < inspect(b) ? -1 : 1;
|
||||
}
|
||||
58
frontend/node_modules/chai/lib/chai/utils/expectTypes.js
generated
vendored
Normal file
58
frontend/node_modules/chai/lib/chai/utils/expectTypes.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* Chai - expectTypes utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {AssertionError} from 'assertion-error';
|
||||
import {flag} from './flag.js';
|
||||
import {type} from './type-detect.js';
|
||||
|
||||
/**
|
||||
* ### .expectTypes(obj, types)
|
||||
*
|
||||
* Ensures that the object being tested against is of a valid type.
|
||||
*
|
||||
* utils.expectTypes(this, ['array', 'object', 'string']);
|
||||
*
|
||||
* @param {unknown} obj constructed Assertion
|
||||
* @param {Array} types A list of allowed types for this assertion
|
||||
* @namespace Utils
|
||||
* @name expectTypes
|
||||
* @public
|
||||
*/
|
||||
export function expectTypes(obj, types) {
|
||||
let flagMsg = flag(obj, 'message');
|
||||
let 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'
|
||||
let str = types
|
||||
.map(function (t, index) {
|
||||
let art = ~['a', 'e', 'i', 'o', 'u'].indexOf(t.charAt(0)) ? 'an' : 'a';
|
||||
let or = types.length > 1 && index === types.length - 1 ? 'or ' : '';
|
||||
return or + art + ' ' + t;
|
||||
})
|
||||
.join(', ');
|
||||
|
||||
let 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
|
||||
);
|
||||
}
|
||||
}
|
||||
34
frontend/node_modules/chai/lib/chai/utils/flag.js
generated
vendored
Normal file
34
frontend/node_modules/chai/lib/chai/utils/flag.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/*!
|
||||
* 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`
|
||||
*
|
||||
* @template {{__flags?: {[key: PropertyKey]: unknown}}} T
|
||||
* @param {T} obj object constructed Assertion
|
||||
* @param {string} key
|
||||
* @param {unknown} [value]
|
||||
* @namespace Utils
|
||||
* @name flag
|
||||
* @returns {unknown | undefined}
|
||||
* @private
|
||||
*/
|
||||
export function flag(obj, key, value) {
|
||||
let flags = obj.__flags || (obj.__flags = Object.create(null));
|
||||
if (arguments.length === 3) {
|
||||
flags[key] = value;
|
||||
} else {
|
||||
return flags[key];
|
||||
}
|
||||
}
|
||||
20
frontend/node_modules/chai/lib/chai/utils/getActual.js
generated
vendored
Normal file
20
frontend/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} obj object (constructed Assertion)
|
||||
* @param {unknown} args chai.Assertion.prototype.assert arguments
|
||||
* @returns {unknown}
|
||||
* @namespace Utils
|
||||
* @name getActual
|
||||
*/
|
||||
export function getActual(obj, args) {
|
||||
return args.length > 4 ? args[4] : obj._obj;
|
||||
}
|
||||
52
frontend/node_modules/chai/lib/chai/utils/getMessage.js
generated
vendored
Normal file
52
frontend/node_modules/chai/lib/chai/utils/getMessage.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*!
|
||||
* Chai - message composition utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {flag} from './flag.js';
|
||||
import {getActual} from './getActual.js';
|
||||
import {objDisplay} from './objDisplay.js';
|
||||
|
||||
/**
|
||||
* ### .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} obj object (constructed Assertion)
|
||||
* @param {IArguments} args chai.Assertion.prototype.assert arguments
|
||||
* @returns {string}
|
||||
* @namespace Utils
|
||||
* @name getMessage
|
||||
* @public
|
||||
*/
|
||||
export function getMessage(obj, args) {
|
||||
let negate = flag(obj, 'negate');
|
||||
let val = flag(obj, 'object');
|
||||
let expected = args[3];
|
||||
let actual = getActual(obj, args);
|
||||
let msg = negate ? args[2] : args[1];
|
||||
let 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;
|
||||
}
|
||||
58
frontend/node_modules/chai/lib/chai/utils/getOperator.js
generated
vendored
Normal file
58
frontend/node_modules/chai/lib/chai/utils/getOperator.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import {flag} from './flag.js';
|
||||
import {type} from './type-detect.js';
|
||||
|
||||
/**
|
||||
* @param {unknown} obj
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isObjectType(obj) {
|
||||
let objectType = type(obj);
|
||||
let 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} obj object (constructed Assertion)
|
||||
* @param {unknown} args chai.Assertion.prototype.assert arguments
|
||||
* @returns {unknown}
|
||||
* @namespace Utils
|
||||
* @name getOperator
|
||||
* @public
|
||||
*/
|
||||
export function getOperator(obj, args) {
|
||||
let operator = flag(obj, 'operator');
|
||||
let negate = flag(obj, 'negate');
|
||||
let expected = args[3];
|
||||
let 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;
|
||||
}
|
||||
|
||||
let isObject = isObjectType(expected);
|
||||
if (/\snot\s/.test(msg)) {
|
||||
return isObject ? 'notDeepStrictEqual' : 'notStrictEqual';
|
||||
}
|
||||
|
||||
return isObject ? 'deepStrictEqual' : 'strictEqual';
|
||||
}
|
||||
24
frontend/node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js
generated
vendored
Normal file
24
frontend/node_modules/chai/lib/chai/utils/getOwnEnumerableProperties.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*!
|
||||
* Chai - getOwnEnumerableProperties utility
|
||||
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {getOwnEnumerablePropertySymbols} from './getOwnEnumerablePropertySymbols.js';
|
||||
|
||||
/**
|
||||
* ### .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} obj
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getOwnEnumerableProperties
|
||||
* @public
|
||||
*/
|
||||
export function getOwnEnumerableProperties(obj) {
|
||||
return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
|
||||
}
|
||||
26
frontend/node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js
generated
vendored
Normal file
26
frontend/node_modules/chai/lib/chai/utils/getOwnEnumerablePropertySymbols.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* 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} obj
|
||||
* @returns {Array}
|
||||
* @namespace Utils
|
||||
* @name getOwnEnumerablePropertySymbols
|
||||
* @public
|
||||
*/
|
||||
export function getOwnEnumerablePropertySymbols(obj) {
|
||||
if (typeof Object.getOwnPropertySymbols !== 'function') return [];
|
||||
|
||||
return Object.getOwnPropertySymbols(obj).filter(function (sym) {
|
||||
return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
|
||||
});
|
||||
}
|
||||
38
frontend/node_modules/chai/lib/chai/utils/getProperties.js
generated
vendored
Normal file
38
frontend/node_modules/chai/lib/chai/utils/getProperties.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/*!
|
||||
* 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
|
||||
* @public
|
||||
*/
|
||||
export function getProperties(object) {
|
||||
let result = Object.getOwnPropertyNames(object);
|
||||
|
||||
/**
|
||||
* @param {unknown} property
|
||||
*/
|
||||
function addProperty(property) {
|
||||
if (result.indexOf(property) === -1) {
|
||||
result.push(property);
|
||||
}
|
||||
}
|
||||
|
||||
let proto = Object.getPrototypeOf(object);
|
||||
while (proto !== null) {
|
||||
Object.getOwnPropertyNames(proto).forEach(addProperty);
|
||||
proto = Object.getPrototypeOf(proto);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
118
frontend/node_modules/chai/lib/chai/utils/index.js
generated
vendored
Normal file
118
frontend/node_modules/chai/lib/chai/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
/*!
|
||||
* chai
|
||||
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
// Dependencies that are used for multiple exports are required here only once
|
||||
import * as checkError from 'check-error';
|
||||
|
||||
// test utility
|
||||
export {test} from './test.js';
|
||||
|
||||
// type utility
|
||||
import {type} from './type-detect.js';
|
||||
export {type};
|
||||
|
||||
// expectTypes utility
|
||||
export {expectTypes} from './expectTypes.js';
|
||||
|
||||
// message utility
|
||||
export {getMessage} from './getMessage.js';
|
||||
|
||||
// actual utility
|
||||
export {getActual} from './getActual.js';
|
||||
|
||||
// Inspect util
|
||||
export {inspect} from './inspect.js';
|
||||
|
||||
// Object Display util
|
||||
export {objDisplay} from './objDisplay.js';
|
||||
|
||||
// Flag utility
|
||||
export {flag} from './flag.js';
|
||||
|
||||
// Flag transferring utility
|
||||
export {transferFlags} from './transferFlags.js';
|
||||
|
||||
// Deep equal utility
|
||||
export {default as eql} from 'deep-eql';
|
||||
|
||||
// Deep path info
|
||||
export {getPathInfo, hasProperty} from 'pathval';
|
||||
|
||||
/**
|
||||
* Function name
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getName(fn) {
|
||||
return fn.name;
|
||||
}
|
||||
|
||||
// add Property
|
||||
export {addProperty} from './addProperty.js';
|
||||
|
||||
// add Method
|
||||
export {addMethod} from './addMethod.js';
|
||||
|
||||
// overwrite Property
|
||||
export {overwriteProperty} from './overwriteProperty.js';
|
||||
|
||||
// overwrite Method
|
||||
export {overwriteMethod} from './overwriteMethod.js';
|
||||
|
||||
// Add a chainable method
|
||||
export {addChainableMethod} from './addChainableMethod.js';
|
||||
|
||||
// Overwrite chainable method
|
||||
export {overwriteChainableMethod} from './overwriteChainableMethod.js';
|
||||
|
||||
// Compare by inspect method
|
||||
export {compareByInspect} from './compareByInspect.js';
|
||||
|
||||
// Get own enumerable property symbols method
|
||||
export {getOwnEnumerablePropertySymbols} from './getOwnEnumerablePropertySymbols.js';
|
||||
|
||||
// Get own enumerable properties method
|
||||
export {getOwnEnumerableProperties} from './getOwnEnumerableProperties.js';
|
||||
|
||||
// Checks error against a given set of criteria
|
||||
export {checkError};
|
||||
|
||||
// Proxify util
|
||||
export {proxify} from './proxify.js';
|
||||
|
||||
// addLengthGuard util
|
||||
export {addLengthGuard} from './addLengthGuard.js';
|
||||
|
||||
// isProxyEnabled helper
|
||||
export {isProxyEnabled} from './isProxyEnabled.js';
|
||||
|
||||
// isNaN method
|
||||
export {isNaN} from './isNaN.js';
|
||||
|
||||
// getOperator method
|
||||
export {getOperator} from './getOperator.js';
|
||||
|
||||
/**
|
||||
* Determines if an object is a `RegExp`
|
||||
* This is used since `instanceof` will not work in virtual contexts
|
||||
*
|
||||
* @param {*} obj Object to test
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isRegExp(obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an object is numeric or not
|
||||
*
|
||||
* @param {unknown} obj Object to test
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isNumeric(obj) {
|
||||
return ['Number', 'BigInt'].includes(type(obj));
|
||||
}
|
||||
31
frontend/node_modules/chai/lib/chai/utils/inspect.js
generated
vendored
Normal file
31
frontend/node_modules/chai/lib/chai/utils/inspect.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// This is (almost) directly from Node.js utils
|
||||
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
|
||||
|
||||
import {inspect as _inspect} from 'loupe';
|
||||
import {config} from '../config.js';
|
||||
|
||||
/**
|
||||
* ### .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).
|
||||
* @returns {string}
|
||||
* @namespace Utils
|
||||
* @name inspect
|
||||
*/
|
||||
export function inspect(obj, showHidden, depth, colors) {
|
||||
let options = {
|
||||
colors: colors,
|
||||
depth: typeof depth === 'undefined' ? 2 : depth,
|
||||
showHidden: showHidden,
|
||||
truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
|
||||
};
|
||||
return _inspect(obj, options);
|
||||
}
|
||||
7
frontend/node_modules/chai/lib/chai/utils/isNaN.js
generated
vendored
Normal file
7
frontend/node_modules/chai/lib/chai/utils/isNaN.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* Chai - isNaN utility
|
||||
* Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
export const isNaN = Number.isNaN;
|
||||
26
frontend/node_modules/chai/lib/chai/utils/isProxyEnabled.js
generated
vendored
Normal file
26
frontend/node_modules/chai/lib/chai/utils/isProxyEnabled.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import {config} from '../config.js';
|
||||
|
||||
/*!
|
||||
* 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
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isProxyEnabled() {
|
||||
return (
|
||||
config.useProxy &&
|
||||
typeof Proxy !== 'undefined' &&
|
||||
typeof Reflect !== 'undefined'
|
||||
);
|
||||
}
|
||||
47
frontend/node_modules/chai/lib/chai/utils/objDisplay.js
generated
vendored
Normal file
47
frontend/node_modules/chai/lib/chai/utils/objDisplay.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*!
|
||||
* Chai - flag utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {inspect} from './inspect.js';
|
||||
import {config} from '../config.js';
|
||||
|
||||
/**
|
||||
* ### .objDisplay(object)
|
||||
*
|
||||
* Determines if an object or an array matches
|
||||
* criteria to be inspected in-line for error
|
||||
* messages or should be truncated.
|
||||
*
|
||||
* @param {unknown} obj javascript object to inspect
|
||||
* @returns {string} stringified object
|
||||
* @name objDisplay
|
||||
* @namespace Utils
|
||||
* @public
|
||||
*/
|
||||
export function objDisplay(obj) {
|
||||
let 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]') {
|
||||
let 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
frontend/node_modules/chai/lib/chai/utils/overwriteChainableMethod.js
generated
vendored
Normal file
69
frontend/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
|
||||
*/
|
||||
|
||||
import {Assertion} from '../assertion.js';
|
||||
import {transferFlags} from './transferFlags.js';
|
||||
|
||||
/**
|
||||
* ### .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
|
||||
* @public
|
||||
*/
|
||||
export function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
|
||||
let chainableBehavior = ctx.__methods[name];
|
||||
|
||||
let _chainingBehavior = chainableBehavior.chainingBehavior;
|
||||
chainableBehavior.chainingBehavior =
|
||||
function overwritingChainableMethodGetter() {
|
||||
let result = chainingBehavior(_chainingBehavior).call(this);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
let newAssertion = new Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
|
||||
let _method = chainableBehavior.method;
|
||||
chainableBehavior.method = function overwritingChainableMethodWrapper() {
|
||||
let result = method(_method).apply(this, arguments);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
let newAssertion = new Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
}
|
||||
90
frontend/node_modules/chai/lib/chai/utils/overwriteMethod.js
generated
vendored
Normal file
90
frontend/node_modules/chai/lib/chai/utils/overwriteMethod.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/*!
|
||||
* Chai - overwriteMethod utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {Assertion} from '../assertion.js';
|
||||
import {addLengthGuard} from './addLengthGuard.js';
|
||||
import {flag} from './flag.js';
|
||||
import {proxify} from './proxify.js';
|
||||
import {transferFlags} from './transferFlags.js';
|
||||
|
||||
/**
|
||||
* ### .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
|
||||
* @public
|
||||
*/
|
||||
export function overwriteMethod(ctx, name, method) {
|
||||
let _method = ctx[name],
|
||||
_super = function () {
|
||||
throw new Error(name + ' is not a function');
|
||||
};
|
||||
|
||||
if (_method && 'function' === typeof _method) _super = _method;
|
||||
|
||||
let 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.
|
||||
let origLockSsfi = flag(this, 'lockSsfi');
|
||||
flag(this, 'lockSsfi', true);
|
||||
let result = method(_super).apply(this, arguments);
|
||||
flag(this, 'lockSsfi', origLockSsfi);
|
||||
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
let newAssertion = new Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
};
|
||||
|
||||
addLengthGuard(overwritingMethodWrapper, name, false);
|
||||
ctx[name] = proxify(overwritingMethodWrapper, name);
|
||||
}
|
||||
89
frontend/node_modules/chai/lib/chai/utils/overwriteProperty.js
generated
vendored
Normal file
89
frontend/node_modules/chai/lib/chai/utils/overwriteProperty.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/*!
|
||||
* Chai - overwriteProperty utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {Assertion} from '../assertion.js';
|
||||
import {flag} from './flag.js';
|
||||
import {isProxyEnabled} from './isProxyEnabled.js';
|
||||
import {transferFlags} from './transferFlags.js';
|
||||
|
||||
/**
|
||||
* ### .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
|
||||
* @public
|
||||
*/
|
||||
export function overwriteProperty(ctx, name, getter) {
|
||||
let _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.
|
||||
let origLockSsfi = flag(this, 'lockSsfi');
|
||||
flag(this, 'lockSsfi', true);
|
||||
let result = getter(_super).call(this);
|
||||
flag(this, 'lockSsfi', origLockSsfi);
|
||||
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
let newAssertion = new Assertion();
|
||||
transferFlags(this, newAssertion);
|
||||
return newAssertion;
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
158
frontend/node_modules/chai/lib/chai/utils/proxify.js
generated
vendored
Normal file
158
frontend/node_modules/chai/lib/chai/utils/proxify.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
import {config} from '../config.js';
|
||||
import {flag} from './flag.js';
|
||||
import {getProperties} from './getProperties.js';
|
||||
import {isProxyEnabled} from './isProxyEnabled.js';
|
||||
|
||||
/*!
|
||||
* Chai - proxify utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/** @type {PropertyKey[]} */
|
||||
const builtins = ['__flags', '__methods', '_obj', 'assert'];
|
||||
|
||||
/**
|
||||
* ### .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.
|
||||
*
|
||||
* @namespace Utils
|
||||
* @template {object} T
|
||||
* @param {T} obj
|
||||
* @param {string} [nonChainableMethodName]
|
||||
* @returns {T}
|
||||
*/
|
||||
export 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.
|
||||
let suggestion = null;
|
||||
let suggestionDistance = 4;
|
||||
getProperties(target).forEach(function (prop) {
|
||||
if (
|
||||
// we actually mean to check `Object.prototype` here
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
!Object.prototype.hasOwnProperty(prop) &&
|
||||
builtins.indexOf(prop) === -1
|
||||
) {
|
||||
let 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} cap
|
||||
* @returns {number} min(string distance between strA and strB, cap)
|
||||
* @private
|
||||
*/
|
||||
function stringDistanceCapped(strA, strB, cap) {
|
||||
if (Math.abs(strA.length - strB.length) >= cap) {
|
||||
return cap;
|
||||
}
|
||||
|
||||
let 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 (let i = 0; i <= strA.length; i++) {
|
||||
memo[i] = Array(strB.length + 1).fill(0);
|
||||
memo[i][0] = i;
|
||||
}
|
||||
for (let j = 0; j < strB.length; j++) {
|
||||
memo[0][j] = j;
|
||||
}
|
||||
|
||||
for (let i = 1; i <= strA.length; i++) {
|
||||
let ch = strA.charCodeAt(i - 1);
|
||||
for (let 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];
|
||||
}
|
||||
24
frontend/node_modules/chai/lib/chai/utils/test.js
generated
vendored
Normal file
24
frontend/node_modules/chai/lib/chai/utils/test.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*!
|
||||
* Chai - test utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
import {flag} from './flag.js';
|
||||
|
||||
/**
|
||||
* ### .test(object, expression)
|
||||
*
|
||||
* Test an object for expression.
|
||||
*
|
||||
* @param {object} obj (constructed Assertion)
|
||||
* @param {unknown} args
|
||||
* @returns {unknown}
|
||||
* @namespace Utils
|
||||
* @name test
|
||||
*/
|
||||
export function test(obj, args) {
|
||||
let negate = flag(obj, 'negate'),
|
||||
expr = args[0];
|
||||
return negate ? !expr : expr;
|
||||
}
|
||||
48
frontend/node_modules/chai/lib/chai/utils/transferFlags.js
generated
vendored
Normal file
48
frontend/node_modules/chai/lib/chai/utils/transferFlags.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*!
|
||||
* 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 {import('../assertion.js').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
|
||||
* @private
|
||||
*/
|
||||
export function transferFlags(assertion, object, includeAll) {
|
||||
let flags = assertion.__flags || (assertion.__flags = Object.create(null));
|
||||
|
||||
if (!object.__flags) {
|
||||
object.__flags = Object.create(null);
|
||||
}
|
||||
|
||||
includeAll = arguments.length === 3 ? includeAll : true;
|
||||
|
||||
for (let flag in flags) {
|
||||
if (
|
||||
includeAll ||
|
||||
(flag !== 'object' &&
|
||||
flag !== 'ssfi' &&
|
||||
flag !== 'lockSsfi' &&
|
||||
flag != 'message')
|
||||
) {
|
||||
object.__flags[flag] = flags[flag];
|
||||
}
|
||||
}
|
||||
}
|
||||
20
frontend/node_modules/chai/lib/chai/utils/type-detect.js
generated
vendored
Normal file
20
frontend/node_modules/chai/lib/chai/utils/type-detect.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @param {unknown} obj
|
||||
* @returns {string}
|
||||
*/
|
||||
export function type(obj) {
|
||||
if (typeof obj === 'undefined') {
|
||||
return 'undefined';
|
||||
}
|
||||
|
||||
if (obj === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
const stringTag = obj[Symbol.toStringTag];
|
||||
if (typeof stringTag === 'string') {
|
||||
return stringTag;
|
||||
}
|
||||
const type = Object.prototype.toString.call(obj).slice(8, -1);
|
||||
return type;
|
||||
}
|
||||
69
frontend/node_modules/chai/package.json
generated
vendored
Normal file
69
frontend/node_modules/chai/package.json
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"author": "Jake Luer <jake@alogicalparadox.com>",
|
||||
"name": "chai",
|
||||
"type": "module",
|
||||
"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": "5.2.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chaijs/chai"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chaijs/chai/issues"
|
||||
},
|
||||
"main": "./chai.js",
|
||||
"scripts": {
|
||||
"prebuild": "npm run clean",
|
||||
"build": "npm run build:esm",
|
||||
"build:esm": "esbuild --bundle --format=esm --keep-names --outfile=chai.js index.js",
|
||||
"format": "prettier --write lib",
|
||||
"pretest": "npm run lint && npm run build",
|
||||
"test": "npm run test-node && npm run test-chrome",
|
||||
"test-node": "c8 --99 --check-coverage mocha --require ./test/bootstrap/index.js test/*.js",
|
||||
"test-chrome": "web-test-runner --playwright",
|
||||
"lint": "npm run lint:js && npm run lint:format",
|
||||
"lint:js": "eslint lib/",
|
||||
"lint:format": "prettier --check lib",
|
||||
"lint:types": "tsc",
|
||||
"clean": "rm -rf chai.js coverage/"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"dependencies": {
|
||||
"assertion-error": "^2.0.1",
|
||||
"check-error": "^2.1.1",
|
||||
"deep-eql": "^5.0.1",
|
||||
"loupe": "^3.1.0",
|
||||
"pathval": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.17.0",
|
||||
"@rollup/plugin-commonjs": "^25.0.7",
|
||||
"@web/dev-server-rollup": "^0.6.1",
|
||||
"@web/test-runner": "^0.18.0",
|
||||
"@web/test-runner-playwright": "^0.11.0",
|
||||
"c8": "^10.1.3",
|
||||
"esbuild": "^0.25.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-jsdoc": "^48.0.4",
|
||||
"mocha": "^10.2.0",
|
||||
"prettier": "^3.4.2",
|
||||
"typescript": "~5.7.3"
|
||||
}
|
||||
}
|
||||
3
frontend/node_modules/chai/register-assert.js
generated
vendored
Normal file
3
frontend/node_modules/chai/register-assert.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import {assert} from './index.js';
|
||||
|
||||
globalThis.assert = assert;
|
||||
3
frontend/node_modules/chai/register-expect.js
generated
vendored
Normal file
3
frontend/node_modules/chai/register-expect.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import {expect} from './index.js';
|
||||
|
||||
globalThis.expect = expect;
|
||||
3
frontend/node_modules/chai/register-should.js
generated
vendored
Normal file
3
frontend/node_modules/chai/register-should.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import {should} from './index.js';
|
||||
|
||||
globalThis.should = should();
|
||||
18
frontend/node_modules/chai/tsconfig.json
generated
vendored
Normal file
18
frontend/node_modules/chai/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "nodenext",
|
||||
"moduleResolution": "nodenext",
|
||||
"types": [],
|
||||
"checkJs": true,
|
||||
"noEmit": true,
|
||||
"isolatedModules": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true
|
||||
},
|
||||
"include": [
|
||||
"lib/**/*.js"
|
||||
]
|
||||
}
|
||||
20
frontend/node_modules/chai/web-test-runner.config.js
generated
vendored
Normal file
20
frontend/node_modules/chai/web-test-runner.config.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { fromRollup } from "@web/dev-server-rollup";
|
||||
import rollupCommonjs from "@rollup/plugin-commonjs";
|
||||
|
||||
const commonjs = fromRollup(rollupCommonjs);
|
||||
|
||||
export default {
|
||||
nodeResolve: true,
|
||||
files: [
|
||||
"test/*.js",
|
||||
"!test/virtual-machines.js"
|
||||
],
|
||||
plugins: [
|
||||
commonjs({
|
||||
include: [
|
||||
// the commonjs plugin is slow, list the required packages explicitly:
|
||||
"**/node_modules/type-detect/**/*",
|
||||
],
|
||||
}),
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user