Skip to content
This repository was archived by the owner on May 26, 2025. It is now read-only.
This repository was archived by the owner on May 26, 2025. It is now read-only.

not matching fields - the actual value and the expected value are printed very far from each other #70

@piotr-s-brainhub

Description

@piotr-s-brainhub

OS: Mac OS X 10.12.6
Node.js: 8.9.4
chai: 3.5.0
chai-subset: 1.6.0
mocha: 3.5.3

I have the following test:

const chai = require('chai');
const chaiSubset = require('chai-subset');

chai.use(chaiSubset);

const { expect } = chai;

const actual = {
  foo1: 'bar-1',
  foo2: 'bar-2',
  foo3: 'bar-3',
  foo4: 'bar-4',
  foo5: 'bar-5',
  foo6: 'bar-6',
  foo7: 'bar-7',
  foo8: 'bar-8',
  foo9: 'bar-9',
};

describe('', () => {
  it('', () => {
    expect(actual).to.containSubset({
      foo5: 'some other value',
    });
  });
});

The actual output:
screen shot 2018-02-27 at 19 44 39

I would like the following output:

       {
      -  "foo5": "bar-5"
      +  "foo5": "some other value"
       }

In case of nested objects it should show the full path to a non-matching fields so e.g.,

       {
         "foo": {
           -  "foo5": "bar-5"
           +  "foo5": "some other value"
         },
         "bar": {
           -  "foo5": "bar-5"
           +  "foo5": "some other value"
         },
         - "baz": "actual value",
         + "baz": "expected value",
         + "lorem": "a field which should exist but does not exist"
       }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions