Comments (1)
Release 0.1.2 is now compatible with should.js (0.4.x) through 99a305190c9bd085ef9d228414b0d975f7517f5d. This includes headers, statusCodes, html/json content types.
Please note the following caveats:
.include() / .keys()
- should.js warns users to switch from
contain
toinclude
, andkeys
doesn't have a subselection modifier - chai
include
is compatible, butcontain
was refactored as the subselection modifier forkeys
.
expect({ foo: 1 }).to.have.keys('foo');
expect({ foo: 1, bar: 2 }).to.contain.keys('foo');
.throw()
- chai allows you to pass (optional) specific type of error to match expectations. behaves the same if error constructor is passed.
var goodFn = function () { 1==1; }
, badFn = function () { throw new Error('testing'); }
, refErrFn = function () { throw new ReferenceError(); };
// all of the following pass
expect(goodFn).to.not.throw();
expect(goodFn).to.not.throw(Error);
expect(badFn).to.throw();
expect(badFn).to.throw(Error);
expect(badFn).to.not.throw(ReferenceError);
expect(refErrFn).to.throw();
expect(refErrFn).to.throw(ReferenceError);
expect(refErrFn).to.not.throw(Error);
expect(refErrFn).to.not.throw(TypeError);
That should cover it. Let me know if there is something I missed.
from chai.
Related Issues (20)
- chai.version field is incorrect HOT 8
- Potential Security Vulnerabilities Detected in Package
- Mention existence of `5.x.x` branch and `v5.0.0-alpha.0` in README HOT 2
- `chai.should()` break error reporting in `node:test` on node `18.17.0`
- 5.0.0-alpha.1 was published as "latest" npm dist-tag HOT 2
- strictEqual / deepStrictEqual behave differently on numbers
- Vulnerability in chai Module HOT 2
- Fix get-func-name HOT 3
- Update dependency on `get-func-name` to at least 2.0.1 to fix CVE HOT 5
- Buffer is not recognized as an object HOT 1
- Officia type definitions for 5.x? HOT 6
- Package subpath './register-should' is not defined by "exports" in node_modules/chai/package.json for node 18.14.0 HOT 1
- ERR_REQUIRE_ESM in v5 HOT 41
- v5 vs chai-as-promised HOT 1
- [v5] `assert.isFunction()` fails with async function HOT 4
- v5 - `Unknown file extension ".ts"` when running with mocha HOT 11
- mutating chai exports no longer works in v5 HOT 22
- Add support for Promise HOT 12
- SyntaxError: Invalid or unexpected token HOT 1
- [email protected] syntax error in assertion.js:69 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chai.