Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

chore: assert.deepEqual => assert.deepStrictEqual#179

Merged
DominicKramer merged 17 commits intomasterfrom
repo-automation/deep-strict-equal
Aug 24, 2018
Merged

chore: assert.deepEqual => assert.deepStrictEqual#179
DominicKramer merged 17 commits intomasterfrom
repo-automation/deep-strict-equal

Conversation

@jkwlui
Copy link
Copy Markdown
Contributor

@jkwlui jkwlui commented Jul 30, 2018

deepEqual is deprecated. Use deepStrictEqual instead

@ghost ghost assigned jkwlui Jul 30, 2018
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 30, 2018
@ghost ghost assigned JustinBeckwith Jul 30, 2018
@DominicKramer DominicKramer changed the title chore: assert.deelEqual => assert.deepStrictEqual chore: assert.deepEqual => assert.deepStrictEqual Aug 3, 2018
@ghost ghost assigned DominicKramer Aug 3, 2018
@DominicKramer DominicKramer force-pushed the repo-automation/deep-strict-equal branch from 63b122e to fb57380 Compare August 3, 2018 21:41
@DominicKramer
Copy link
Copy Markdown
Contributor

The root cause of why this PR was causing the tests to fail is summarized in the code below. I used json-stable-stringify to solve this. However, this looks like a solution that could be used in all the repos. @JustinBeckwith what do you think?

const assert = require('assert');
const util = require('util');
const stringify = require('json-stable-stringify');

class SomeClass {
  constructor(x, y) {
    this.x = x;
    this.y = y;
  }
}

const ob1 = new SomeClass(1, 2);
const ob2 = {
  x: 1,
  y: 2
};

assert.deepEqual(ob1, ob2);  // true
assert.deepStrictEqual(ob1, ob2); // false

// This also does a deep check that works in the situation
// when `assert.deepStrictEqual` fails.
assert.strictEqual(stringify(ob1), stringify(ob2)); // true

@DominicKramer DominicKramer force-pushed the repo-automation/deep-strict-equal branch from baf018e to c86325e Compare August 7, 2018 00:37
Copy link
Copy Markdown
Contributor

@JustinBeckwith JustinBeckwith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, it feels like you're using deepStrictEqual in a lot of places where assert.strictEqual would be sufficient.

assert.ifError(err);
assert(is.object(response));
assert.deepEqual(body, {});
deepStrictEqual(body, {});

This comment was marked as spam.

This comment was marked as spam.

it('Should assign the value to the method property', () => {
ric.setMethod(VALID_STRING_INPUT);
assert.deepEqual(ric.method, VALID_STRING_INPUT);
deepStrictEqual(ric.method, VALID_STRING_INPUT);

This comment was marked as spam.

This comment was marked as spam.

@DominicKramer DominicKramer force-pushed the repo-automation/deep-strict-equal branch from c86325e to 4f04428 Compare August 21, 2018 17:49
@DominicKramer
Copy link
Copy Markdown
Contributor

@JustinBeckwith PTAL

@DominicKramer DominicKramer merged commit 097a7ef into master Aug 24, 2018
@jmdobry jmdobry deleted the repo-automation/deep-strict-equal branch October 16, 2018 19:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants