Automattic / Automattic/expect.js

'withArgs' allways runs in global scope

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

Description

I'm trying to do something like that:

```
expect(obj.method).withArgs(arg1).to.not.throwException();
```

And when I do it I expect that `obj.method` would be calling in `obj` context (_this_ would be a reference to `obj`).
But there is a string:

```
fn.apply(null, args);
```

in `Assertion.prototype.withArgs`. So `fn` would _always_ called in context of null, which in browser would be replacing with Window object. And I'll always get an `global leaks detected` error even if there is no actually global leaks.

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.