From 222584543dd4ea38a619fc6e22734c3a9e17af85 Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Tue, 1 Jan 2019 21:59:56 +0100 Subject: [PATCH 1/3] Simplify to be rejected with --- lib/assertions.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/assertions.js b/lib/assertions.js index 6a5afd7b1..176b47230 100644 --- a/lib/assertions.js +++ b/lib/assertions.js @@ -2265,17 +2265,7 @@ module.exports = expect => { expect.errorMode = 'nested'; return expect(subject, 'to be rejected').tap(err => expect.withError( - () => { - if ( - err && - err._isUnexpected && - (typeof value === 'string' || isRegExp(value)) - ) { - return expect(err, 'to have message', value); - } else { - return expect(err, 'to [exhaustively] satisfy', value); - } - }, + () => expect(err, 'to [exhaustively] satisfy', value), e => { e.originalError = err; throw e; From 0552c0d0c8d07a4f4f04487cb0cee572532d6d3e Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Tue, 1 Jan 2019 22:00:25 +0100 Subject: [PATCH 2/3] Simplify to call the callback with error --- lib/assertions.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/assertions.js b/lib/assertions.js index 176b47230..d4fc4f6ee 100644 --- a/lib/assertions.js +++ b/lib/assertions.js @@ -2515,15 +2515,7 @@ module.exports = expect => { (expect, subject, value) => expect(subject, 'to call the callback with error').tap(err => { expect.errorMode = 'nested'; - if ( - err && - err._isUnexpected && - (typeof value === 'string' || isRegExp(value)) - ) { - return expect(err, 'to have message', value); - } else { - return expect(err, 'to satisfy', value); - } + expect(err, 'to satisfy', value); }) ); }; From d900648386c2c3abdf44a1728a5d5d58fd375918 Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Tue, 1 Jan 2019 22:14:11 +0100 Subject: [PATCH 3/3] Remove unused variable --- lib/assertions.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/assertions.js b/lib/assertions.js index d4fc4f6ee..938bbf0fa 100644 --- a/lib/assertions.js +++ b/lib/assertions.js @@ -4,7 +4,6 @@ const arrayChanges = require('array-changes'); const arrayChangesAsync = require('array-changes-async'); const throwIfNonUnexpectedError = require('./throwIfNonUnexpectedError'); const objectIs = utils.objectIs; -const isRegExp = utils.isRegExp; const extend = utils.extend; module.exports = expect => {