Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectID error message should use string, not buffer #4292

Closed
icetbr opened this issue May 16, 2020 · 2 comments
Closed

ObjectID error message should use string, not buffer #4292

icetbr opened this issue May 16, 2020 · 2 comments

Comments

@icetbr
Copy link

icetbr commented May 16, 2020

const expect = require('chai').expect;
const ObjectID = require('mongodb').ObjectID;

test('ObjectId comparison', () => {
  expect(ObjectID()).to.deep.equal(ObjectID());
});

actual

       1 | {
       2 |   "_bsontype": "ObjectID"
       3 |   "id": [Buffer: [
       4 |     94
       5 |     191
       6 |     47
       7 |     62
       8 |     96
       9 |     28
      10 |     42
      11 |     17
      12 |     32
      13 |     235
      14 |     123
      15 |     242243
      16 |   ]]
      17 | }

expected (8/7 are red/green)

       1 | 5ebf2fcf6f2d42116bef09f87
@icetbr icetbr added the type: feature enhancement proposal label May 16, 2020
@Munter
Copy link
Contributor

Munter commented May 16, 2020

Please file this request in the chai repository

@Munter Munter closed this as completed May 16, 2020
@Munter Munter removed the type: feature enhancement proposal label May 16, 2020
@icetbr
Copy link
Author

icetbr commented May 16, 2020

Chai mantainers(?) say its the reporter responsibility.

chaijs/chai#469

If I try catch the chai expect, I get a pretty string like I wanted.

I could create a custom reporter, but I think t should be default behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants