breaking change in 2.0 (null, undefined, arguments, ok, true, false, empty, exist)
See original GitHub issueBefore the 2.0 release of Chai, these assertions could be written as properties or as functions. For example:
expect(foo).to.be.true;
expect(foo).to.be.true();
expect(foo).to.be.empty;
expect(foo).to.be.empty();
expect(foo).to.exist;
expect(foo).to.exist();
expect(foo).to.be.null;
expect(foo).to.be.null();
The documentation on chaijs.com even explained that this dual-syntax was there to play nice with some IDEs and linting tools that flag the non-function syntax as an error. But in 2.0, the function syntax no longer exists. Was it removed by accident, or was there a reason for it?
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Documentation - TypeScript 2.0
Null - and undefined-aware types. TypeScript has two special types, Null and Undefined, that have the values null and undefined respectively.
Read more >Breaking Changes · microsoft/TypeScript Wiki - GitHub
In TypeScript 4.8, under strictNullChecks , the type-checker disables a type safety hole that was maintained for backwards-compatibility, where ...
Read more >JavaScript check if variable exists (is defined/initialized)
The typeof operator will check if the variable is really undefined. ... work differently in Javascript, empty array [] and empty object {}...
Read more >Understanding null safety - Dart programming language
Non-nullable and nullable types. Null safety eliminates that problem at the root by changing the type hierarchy. The Null type still exists, but...
Read more >Everything you wanted to know about $null - PowerShell
You can think of NULL as an unknown or empty value. A variable is NULL until you assign a value or an object...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For more context on all of this:
.to.be.true()
).I think the dust has settled on this now. I’m going to close this one, as I’m pretty sure we’re sticking with the property style of assertions. dirty-chai exists and is a perfectly suitable plugin for this - and is compatible with all other plugins.