Chai Assertion error doesn't have 'operator' attribute
See original GitHub issueHey everyone,
I’m currently working on a feature in jest
repo (https://github.com/facebook/jest/pull/8454).
While I came across that output is as follows. (https://github.com/facebook/jest/pull/8454/files#diff-e6f1eef106ffd32cb2e65acae35856b8R7)
assert.(received, expected)
Expected value "hello sunshine"
Received:
"hello world"
Message:
expected 'hello world' to equal 'hello sunshine'
Difference:
- Expected
+ Received
- hello sunshine
+ hello world
11 | describe('chai.js assertion library test', () => {
12 | it('expect', () => {
> 13 | chai.expect('hello world').to.equal('hello sunshine');
| ^
14 | });
15 |
16 | it('should', () => {
at Object.equal (__tests__/chai_assertion.js:13:35)
it is because of https://github.com/facebook/jest/blob/master/packages/jest-circus/src/formatNodeAssertErrors.ts#L127, unable to extract the operator.
In https://nodejs.org/api/assert.html#assert_new_assert_assertionerror_options shows a property of operator
.
is it this a bug or have I taken a wrong approach? Thanks a lot.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
API Reference - Chai Assertion Library
Asserts that object does not have a direct or inherited property named by property with value given by value . Uses a deep...
Read more >how to assert in my tests that a Chai assertion will fail (Error vs ...
The reason is by doing import {AssertionError} from ... it is actually looking for an exported property of the package 'assertion-error', ...
Read more >Assert - Chai
Asserts that object does not have a property named by property , which can be a string using dot- and bracket-notation for deep...
Read more >Chai.js cheatsheet - Devhints
expect (x).to.be.equal(y) 〉 assert.equal(x, y) 〉 .to.be.true 〉 jQuery, assertions, TDD and BDD, and other Chai examples. · One-page guide to Chai.js.
Read more >Node.js Assert Module - W3Schools
The assert module provides a way of testing expressions. If the expression evaluates to 0, or false, an assertion failure is being caused,...
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
assert.(received, expected)
at the top, it should sayassert.equal(received, expected)
or some suchFixed with https://github.com/chaijs/chai/pull/1257