Allow notStrictEqual for BDD style tests (expect)
See original GitHub issueFrom the documentation it doesn’t seem like the following behaviour:
assert.notStrictEqual(3, '3', 'no coercion for strict equality');
is available for bdd style tests.
The only equality tests in the “expect” part of the library is this:
expect(3).to.equal('3');
but that will fail because it uses ===
for the comparison.
Is there any way to get the same behaviour as notStrictEqual
for expect?
Issue Analytics
- State:
- Created 9 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Assertion Styles - Chai
Assertion Styles. This section of the guide introduces you to the three different assertion styles that you may use in your testing environment....
Read more >Automated testing with Mocha - آموزش جاوااسکریپت مدرن
Let's start with a technique named Behavior Driven Development or, in short, BDD. BDD is three things in one: tests AND documentation AND...
Read more >Assertions | Cypress Documentation
BDD Assertions. These chainers are available for BDD assertions ( expect / should ). Aliases listed can be used interchangeably with their original...
Read more >Chapter 9. Testing Node applications
The tests also give you confidence that your recent changes haven't introduced ... Although it defaults to a BDD style, you can also...
Read more >Unit Testing in JavaScript
Let's test some JavaScript. We'll see two frameworks: QUnit and Mocha. ... notStrictEqual(actual, expected, message) passes if actual !== expected; assert.
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
Hey @wearhere.
If you want to avoid casting string subclass to primitive on every assertion, I believe may want to write a plugin that adds a getter like
.loose
that sets a flag on an assertion, and overwriteequal
method to respect that flag. Something like:@nadrane why not contribute it as a PR to chai?