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

Update getName to fix inspect in Firefox #806

Merged
merged 1 commit into from
Sep 27, 2016
Merged

Conversation

meeber
Copy link
Contributor

@meeber meeber commented Sep 26, 2016

This test started failing in Firefox after #789 was merged because Function.prototype.toString doesn't work on proxified functions per this article. I traced the specific error to this line, which was being called by Chai's inspect.

Replacing the logic in Chai's getName with @lucasfcosta's logic from getConstructorName in the check-error repository fixed the problem without breaking any tests.

Not sure it's worth it to pull that function into a separate module that's required by both Chai and check-error; seems like it might be overkill. An alternative would be for check-error to expose the function for Chai to require, but that doesn't quite feel right either. I'm okay with the duplicate logic across repos here, but if someone feels strongly otherwise I'm easily swayed.

@lucasfcosta
Copy link
Member

I see no problem in duplicating it, this code is too small for us to separate it from the core. However if anyone wants to, I see no problem in doing that since there are many "micro modules" around (I think we all remember that left pad module).

Also, exposing that function on check-error feels wrong, since it has nothing to do with the functionality that module aims to provide.

This LGTM, but it would be nice to hear opinions from others just to make sure we all agree about that.

And, before I forget, good job @meeber 😄

@vieiralucas
Copy link
Member

vieiralucas commented Sep 27, 2016

Even if this fires my OCD because of DRY reasons 😸
I agree with you guys that creating a module just for this is overkill.

LGTM

Nice one @meeber

EDIT:
I think it would be great to hear @keithamus opinion before merging

@keithamus
Copy link
Member

LGTM. Let's ship it for now :shipit: but I think its worth pulling into a new module one day. I, for one, welcome our micro module overlords.

@keithamus keithamus merged commit 92b1ff7 into chaijs:master Sep 27, 2016
@meeber meeber deleted the get-name branch August 6, 2017 13:47
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.

None yet

4 participants