Automattic / Automattic/expect.js

Loose equality checking for functions

Open
#71 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.1k
Forks
207
PR merge metrics
No merged PRs in 30d

Description

Loose equality checking does not currently work with functions:

``` js
expect(function() {}).to.eql(function() {}); // throws
```

We could use the `toString` method of the function to check for equality. This would likely fall back to checking if both objects are functions in older browsers. Some engines perform transforms on the functions (like precomputing static operations), but they should do so consistently, so the functions would still come out the same.

Thoughts?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.