debitoor / chai-subset

"containSubset" object properties matcher for Chai
http://chaijs.com/plugins/chai-subset/
MIT License
82 stars 20 forks source link

Non-descriptive error #17

Closed tnrich closed 8 years ago

tnrich commented 8 years ago

Hey there, I'm running this test:

sequenceData.features.should.should.containSubset([{
                start: 0,
                end: 2
            }, {
                start: 1,
                end: 1
            }])

Which is failing with this error:

1) deleteSequence deletes end of sequence and adjusts annotations correctly:
     AssertionError: expected { Object (__flags) } to contain subset [ Array(2) ]
      at app/actions/deleteSequence.test.js:58:49
      at deleteSequence (app/actions/deleteSequence.js:50:5)
      at Context.<anonymous> (app/actions/deleteSequence.test.js:47:9)

Any idea how I can get it to throw a more descriptive error. I was hoping I would be able to see what those two objects actually were...

Thanks!

eagleeye commented 8 years ago

Hi @tnrich! What reporters are you using, which version of mocha, chai? what i see from console with spec reporter when i'm failing one of the tests in this modules with modules that are mentioned in this module for test, So i see actual error image Other possible solution that i use in my daily life is WebStorm IDE with mocha test runner image So i can click on "Click to see the difference to see difference" and it will use diff comparison to show you what and where is wrong in your long object.


So what would i suggest you:

tnrich commented 8 years ago

Hey @eagleeye, thanks for the advice! Cloning this repo and running the failing test did output correctly to my console. I haven't quite figured out what is different between our test setups. One thing it might be is that I'm using babel to compile es6 code before running them.. Not sure if that is it though. I'll tell you if/when I get it.

tnrich commented 8 years ago

Update:

It's no wonder I was getting a strange error.

I was calling should.should by accident.

If you look above

sequenceData.features.should.***should***.containSubset([{
                start: 0,
                end: 2
            }, {
                start: 1,
                end: 1
            }])