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

add QUnit deepEqual #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Krinkle
Copy link

@Krinkle Krinkle commented Sep 12, 2020

Follows-up c0f8f22.

@Krinkle
Copy link
Author

Krinkle commented Sep 12, 2020

QUnit was originally developed by John Resig as part of jQuery. [...] QUnit's assertion methods follow the CommonJS Unit Testing specification, which was to some degree influenced by QUnit.

I can't believe this […] The docs also mention a complete re-write of QUnit […]

The original QUnit indeed used a plethora of global variables similar to Mocha and various other JS testing frameworks from that era. I believe the idea is that the testing framework would be given a dedicated web page (or Node.js process) with no other libraries present, where it then exports its functions as a way of almost augmenting the language syntax with additional operators.

The complete rewrite, as done by yours truly and team, deprecated these in QUnit 1.16, in favour of a more lexically bound API (QUnit 2.0).

Given this state of affairs, it is perhaps not so surprising that issue joyent/node#7161 prompted the suggestion to add deepStrictEqual […]

One gets the impression the CommonJS folks who wrote the unit testing specs must have started out, like, "wah equality, that's JS ==", and then at some point realized "cool, there's JS ===, let's add it, too".

A little later […] those folks went, like, "oh noes, we need deepEqual, let's add it already". Of course, since they started out with the broken JS == operator, they recycled that experience when implementing deepEqual, so now their deepEqual is as broken as their equal.

For what it's worth, the CommonJS spec actually describes === strict equality in its definition of deepEqual, and QUnit has always implemented it that way. Hence neither the spec nor QUnit has any deepStrictEqual method. The choice of using loose == equality (arguably a mistake) appears to have been specific to Node.js.

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

Successfully merging this pull request may close these issues.

1 participant