Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Comments

@arnoldmanzano
Copy link

arnoldmanzano commented Sep 5, 2017

Hi should.js team!

Noticed unexpected results when using .match with Date objects.

Answer several questions if it is a bug:

Node.js version?

6.11.1

Should.js version?

12.0.0
11.2.1

How to reproduce it?

This results in a false negative fail, but I believe it should be passing.
(new Date('2017-09-02')).should.not.match(new Date('2017-09-03'));

This test is passing, but I believe it should be failing.
(new Date('2017-09-02')).should.match(new Date('2017-09-03'));

Normally, we would use .eql for date assertions, but it was discovered when we were matching objects with date properties. The example below is resulting in a false negative fail.

      ({
        a: new Date('2017-09-02'),
        b: 12
      }).should.not.match({
        a: new Date('2017-09-03'),
        b: 12
      });

Thanks!

@btd
Copy link
Member

btd commented Sep 5, 2017

Yep this is known 'limitation'. Problem that Dates considered as empty objects. I has such bug already in past #42, it is literally the same bug. It seems i need to add special handling for some built-in object like Date's (maybe also for wrapper types, RegExp, Symbols).

Do you have some ideas how this formally should be handled?

@btd btd closed this as completed in fe1ae5c Sep 5, 2017
@btd
Copy link
Member

btd commented Sep 5, 2017

I fixed this in 13.0.0 (yes while it is a bug, it is still breaking change).

mkrufky added a commit to mkrufky/node-dvbtee that referenced this issue Sep 6, 2017
Update should to the latest version 🚀

---

## Version **13.0.0** of [should](https://github.com/shouldjs/should.js) just got published.

<table>
  <tr>
    <th align=left>
      Dependency
    </td>
    <td>
      should
    </td>
  </tr>
  <tr>
    <th align=left>
      Current Version
    </td>
    <td>
      12.0.0
    </td>
  </tr>
  <tr>
    <th align=left>
      Type
    </td>
    <td>
      devDependency
    </td>
  </tr>
</table>

The version **13.0.0** is **not covered** by your **current version range**.

Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.

I recommend you look into these changes and try to get onto the latest version of should.
Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.


---


<details>
<summary>Commits</summary>
<p>The new version differs by 11 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/b9bf8ff6fd40e5ecbaa854461b957f3d890d065a"><code>b9bf8ff</code></a> <code>Release 13.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/c8a5851e52b70ae37a514de758c38fb4dac08ebb"><code>c8a5851</code></a> <code>Remove ignored file</code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/ebfdd1997258e05acf8f371e06bf0f9b39461945"><code>ebfdd19</code></a> <code>Travis uses node 8</code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/92d0db14efc9c7e1521f091fe3cb950d64829dde"><code>92d0db1</code></a> <code>Remove bower, as it seems nobody uses it</code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/fe1ae5cf516788999f373230169e7d0e5f9459fc"><code>fe1ae5c</code></a> <code>Fix <a href="https://urls.greenkeeper.io/shouldjs/should.js/issues/150" class="issue-link js-issue-link" data-url="shouldjs/should.js#150" data-id="255243808" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">shouldjs/should.js#150</a></code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/c4924be69835d28e71f9d9dda5bf4b3ac595c62c"><code>c4924be</code></a> <code>Fix build and restore old files. In a bit silly way, but it works.</code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/c946259054869c258fa43e62ab6229a4e70f1a94"><code>c946259</code></a> <code>Fix tests</code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/90bf91e4eb32c86fd9482af950043bb79d822c12"><code>90bf91e</code></a> <code>Prettier everything</code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/999b122277e2457df6b0e5c6b2a5953eab51f1f2"><code>999b122</code></a> <code>Add first version of TS typings for should.js</code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/06062c5bbcd14c622a4479719d9287c93951b237"><code>06062c5</code></a> <code>Reorganize build</code></li>
<li><a href="https://urls.greenkeeper.io/shouldjs/should.js/commit/c50e66a96ed2f6bdfed611727612cd0856953d80"><code>c50e66a</code></a> <code>Disable package-lock.json because i am controlling all dependencies</code></li>
</ul>
<p>See the <a href="https://urls.greenkeeper.io/shouldjs/should.js/compare/52dc12106892a83f8ab10f5733449fd51703537b...b9bf8ff6fd40e5ecbaa854461b957f3d890d065a">full diff</a></p>
</details>

<details>
  <summary>Not sure how things should work exactly?</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html) and of course you may always [ask my humans](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>


---


Your [Greenkeeper](https://greenkeeper.io) Bot 🌴
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.