Skip to content

Commit

Permalink
Merge 8809607 into 6377e5b
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed Sep 18, 2018
2 parents 6377e5b + 8809607 commit 8981c5b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Expand Up @@ -26,6 +26,7 @@ jobs:
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list.d/google.list
apt-get -qq update
apt-get -qq install -y --no-install-recommends google-chrome-stable
apt-get -qq install -y --no-install-recommends google-chrome-unstable
fi
- run:
Expand All @@ -36,7 +37,7 @@ jobs:
npm run lint
npm run test-headless -- --chrome $(which google-chrome-unstable) --allow-chrome-as-root
npm run test-webworker -- --chrome $(which google-chrome-unstable) --allow-chrome-as-root
npm run test-webworker -- --chrome $(which google-chrome-stable) --allow-chrome-as-root
npm run test-esm-bundle
if [ -z "$CIRCLE_PULL_REQUESTS" ]; then
Expand Down
2 changes: 1 addition & 1 deletion lib/sinon/fake.js
Expand Up @@ -45,7 +45,7 @@ function wrapFunc(f) {
p.callback = callback;
/* eslint-enable no-use-before-define */

return f && f.apply(f, arguments);
return f && f.apply(this, arguments);
};
var p = cleanProxy(spy(fakeInstance));

Expand Down
11 changes: 11 additions & 0 deletions test/fake-test.js
Expand Up @@ -51,6 +51,17 @@ describe("fake", function () {

describe("when passed a Function", function () {
verifyProxy(fake, function () {});

it("should keep the `this` context of the wrapped function", function () {
function method() { return this.foo; }
var o = { foo: 42 };
var fakeMethod = fake(method);

var result = fakeMethod.call(o);

assert.equals(fakeMethod.callCount, 1);
assert.equals(result, 42);
});
});

describe("when passed no value", function () {
Expand Down

0 comments on commit 8981c5b

Please sign in to comment.