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

stack trace wrong for overridden properties #659

Closed
Turbo87 opened this issue Apr 1, 2016 · 3 comments · Fixed by #661
Closed

stack trace wrong for overridden properties #659

Turbo87 opened this issue Apr 1, 2016 · 3 comments · Fixed by #661

Comments

@Turbo87
Copy link
Contributor

Turbo87 commented Apr 1, 2016

let's say I use the following assertion:

expect(true).to.be.undefined;

I get the following error with the expected stack trace:

AssertionError: expected true to be undefined
 at Context.<anonymous> (test/test.js:18:25)

If I overwrite the undefined property like this:

Assertion.overwriteProperty('undefined', function(_super) {
  return function() {
    _super.call(this);
  };
});

I'm getting the following error with an extended stack trace:

AssertionError: expected true to be undefined
 at Assertion.<anonymous> (src/chai-files.js:52:12)
 at Assertion.Object.defineProperty.get (node_modules/chai/lib/chai/utils/overwriteProperty.js:50:37)
 at Context.<anonymous> (test/test.js:18:25)

If I overwrite the undefined property like this:

Assertion.overwriteProperty('undefined', function(_super) {
  return function() {
    this.assert(false, 'foo', 'bar');
  };
});

I'm getting the following error with a missing stack trace:

AssertionError: foo
@Turbo87
Copy link
Contributor Author

Turbo87 commented Apr 1, 2016

not sure but maybe something like in #514 should be used in the overwrite...() methods too

@keithamus
Copy link
Member

Good catch @Turbo87. I think you're right about #514. Fancy making a PR?

@Turbo87
Copy link
Contributor Author

Turbo87 commented Apr 1, 2016

@keithamus adding the #514 change to overwriteProperty() seems to fix the seconds issue, but not the first. I'll see if I can come up with a way to fix the first too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants