Skip to content

Commit

Permalink
Merge pull request #567 from unexpectedjs/chore/unsupportThisInAssert…
Browse files Browse the repository at this point in the history
…ions

Remove long-deprecated support for this.subject etc. in assertion handlers
  • Loading branch information
papandreou committed Jan 5, 2019
2 parents a10c31b + 3b2594e commit 55b7bb6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
4 changes: 1 addition & 3 deletions lib/Unexpected.js
Expand Up @@ -1466,9 +1466,7 @@ Unexpected.prototype._expect = function expect(context, args) {
wrappedExpect.argTypes = wrappedExpect._getArgTypes();
}

return oathbreaker(
assertionRule.handler.call(wrappedExpect, wrappedExpect, subject, ...args)
);
return oathbreaker(assertionRule.handler(wrappedExpect, subject, ...args));
}

try {
Expand Down
2 changes: 1 addition & 1 deletion test/api/shift.spec.js
Expand Up @@ -133,7 +133,7 @@ describe('expect.shift', () => {
expect,
subject
) {
return this.shift(expect, `foo${subject}`, 0);
return expect.shift(expect, `foo${subject}`, 0);
});
clonedExpect(
'foo',
Expand Down
13 changes: 0 additions & 13 deletions test/unexpected.spec.js
Expand Up @@ -175,19 +175,6 @@ describe('unexpected', () => {
new Error('foo')
);
});

it('should make the wrapped expect available as the context (legacy)', () => {
var clonedExpect = expect
.clone()
.addAssertion('to foo', function(expect, subject) {
this.errorMode = 'nested';
expect(this, 'to be', expect);
});

return expect(function() {
return clonedExpect(undefined, 'to foo');
}, 'not to error');
});
});

describe('when given an expect.it as the 2nd argument', () => {
Expand Down

0 comments on commit 55b7bb6

Please sign in to comment.