title: Chai deep equal not working on URLSearchParams
body: <p>I'm trying to test if my <code>URLSearchParams</code> are correct with chai's <code>to.deep.equal</code> option but it returns <code>true</code> (is equal) when it shouldn't.</p>
  <p>See the running code at <a href="https://stackblitz.com/edit/node-qx7qra?file=index.test.js" rel="nofollow noreferrer">https://stackblitz.com/edit/node-qx7qra?file=index.test.js</a></p>
  <p>Let's assume that we're testing this function:</p>
  <pre class="lang-js prettyprint-override"><code>function getIncorrectParams() {
    return new URLSearchParams({
      from: '2020',
      to: '2021',
      ids: ['abc-1'],
    });
  }
  </code></pre>
  <p>If I write:</p>
  <pre class="lang-js prettyprint-override"><code>test('via string', () =&gt; {
    expect(getIncorrectParams().toString()).not.to.equal(
      new URLSearchParams({
        from: '2020',
        to: '2021',
        ids: ['abc-1', 'abc-2'],
      }).toString()
    );
  });
  </code></pre>
  <p>Chai correctly notices that the strings are not the same, good. But as soon as I remove the <code>toString</code> and test with:</p>
  <pre class="lang-js prettyprint-override"><code>test('via deep equal', () =&gt; {
    expect(getIncorrectParams()).not.to.deep.equal(
      new URLSearchParams({
        from: '2020',
        to: '2021',
        ids: ['abc-1', 'abc-2'],
      })
    );
  });
  </code></pre>
  <p>It claims that the assertion failed because the two objects are &quot;equal&quot;. Note if you actually go ahead and run the example, the debug output clearly shows that there are differences!</p>
  <p>And the <code>deep.equal</code> property works if I use &quot;normal&quot; object. See this example where I convert the <code>URLSearchParams</code> to a &quot;plain object&quot; first:</p>
  <pre class="lang-js prettyprint-override"><code>test('deep equal plain objects', () =&gt; {
    expect(Object.fromEntries(getIncorrectParams().entries())).not.to.deep.equal({
      from: '2020',
      to: '2021',
      ids: ['abc-1', 'abc-2'],
    });
  });
  </code></pre>