-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: delete expect and jest-matcher-utils dependencies (#405)
BREAKING CHANGE: Drop support for `jest@<27.2.5`
- Loading branch information
1 parent
524306c
commit 98ef8c7
Showing
108 changed files
with
918 additions
and
1,041 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, after) => () => | ||
matcherHint('.not.toBeAfter', 'received', '') + | ||
const passMessage = (utils, received, after) => () => | ||
utils.matcherHint('.not.toBeAfter', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after ${printReceived(after)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be after ${utils.printReceived(after)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, after) => () => | ||
matcherHint('.toBeAfter', 'received', '') + | ||
const failMessage = (utils, received, after) => () => | ||
utils.matcherHint('.toBeAfter', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after ${printReceived(after)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be after ${utils.printReceived(after)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeAfter(date, after) { | ||
const pass = predicate(date, after); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, after) }; | ||
return { pass: true, message: passMessage(this.utils, date, after) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, after) }; | ||
return { pass: false, message: failMessage(this.utils, date, after) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, before) => () => | ||
matcherHint('.not.toBeAfterOrEqualTo', 'received', '') + | ||
const passMessage = (utils, received, before) => () => | ||
utils.matcherHint('.not.toBeAfterOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after or equal to ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be after or equal to ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, before) => () => | ||
matcherHint('.toBeAfterOrEqualTo', 'received', '') + | ||
const failMessage = (utils, received, before) => () => | ||
utils.matcherHint('.toBeAfterOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after or equal to ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be after or equal to ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeAfterOrEqualTo(date, after) { | ||
const pass = predicate(date, after); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, after) }; | ||
return { pass: true, message: passMessage(this.utils, date, after) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, after) }; | ||
return { pass: false, message: failMessage(this.utils, date, after) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = received => () => | ||
matcherHint('.not.toBeArray', 'received', '') + | ||
const passMessage = (utils, received) => () => | ||
utils.matcherHint('.not.toBeArray', 'received', '') + | ||
'\n\n' + | ||
'Expected value to not be an array received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = received => () => | ||
matcherHint('.toBeArray', 'received', '') + | ||
const failMessage = (utils, received) => () => | ||
utils.matcherHint('.toBeArray', 'received', '') + | ||
'\n\n' + | ||
'Expected value to be an array received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeArray(expected) { | ||
const pass = predicate(expected); | ||
if (pass) { | ||
return { pass: true, message: passMessage(expected) }; | ||
return { pass: true, message: passMessage(this.utils, expected) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(expected) }; | ||
return { pass: false, message: failMessage(this.utils, expected) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
import { matcherHint, printExpected, printReceived } from 'jest-matcher-utils'; | ||
import { determinePropertyMessage } from '../../utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (actual, expected) => () => | ||
`${matcherHint('.not.toBeArrayOfSize')} | ||
const passMessage = (utils, actual, expected) => () => | ||
`${utils.matcherHint('.not.toBeArrayOfSize')} | ||
Expected value to not be an array of size: | ||
${printExpected(expected)} | ||
${utils.printExpected(expected)} | ||
Received: | ||
value: ${printReceived(actual)} | ||
length: ${printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
value: ${utils.printReceived(actual)} | ||
length: ${utils.printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
|
||
const failMessage = (actual, expected) => () => | ||
`${matcherHint('.toBeArrayOfSize')} | ||
const failMessage = (utils, actual, expected) => () => | ||
`${utils.matcherHint('.toBeArrayOfSize')} | ||
Expected value to be an array of size: | ||
${printExpected(expected)} | ||
${utils.printExpected(expected)} | ||
Received: | ||
value: ${printReceived(actual)} | ||
length: ${printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
value: ${utils.printReceived(actual)} | ||
length: ${utils.printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
|
||
export function toBeArrayOfSize(actual, expected) { | ||
const pass = predicate(actual, expected); | ||
if (pass) { | ||
return { pass: true, message: passMessage(actual, expected) }; | ||
return { pass: true, message: passMessage(this.utils, actual, expected) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(actual, expected) }; | ||
return { pass: false, message: failMessage(this.utils, actual, expected) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, before) => () => | ||
matcherHint('.not.toBeBefore', 'received', '') + | ||
const passMessage = (utils, received, before) => () => | ||
utils.matcherHint('.not.toBeBefore', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be before ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, before) => () => | ||
matcherHint('.toBeBefore', 'received', '') + | ||
const failMessage = (utils, received, before) => () => | ||
utils.matcherHint('.toBeBefore', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be before ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeBefore(date, before) { | ||
const pass = predicate(date, before); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, before) }; | ||
return { pass: true, message: passMessage(this.utils, date, before) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, before) }; | ||
return { pass: false, message: failMessage(this.utils, date, before) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, before) => () => | ||
matcherHint('.not.toBeBeforeOrEqualTo', 'received', '') + | ||
const passMessage = (utils, received, before) => () => | ||
utils.matcherHint('.not.toBeBeforeOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before or equal to ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be before or equal to ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, before) => () => | ||
matcherHint('.toBeBeforeOrEqualTo', 'received', '') + | ||
const failMessage = (utils, received, before) => () => | ||
utils.matcherHint('.toBeBeforeOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before or equal to ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be before or equal to ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeBeforeOrEqualTo(date, before) { | ||
const pass = predicate(date, before); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, before) }; | ||
return { pass: true, message: passMessage(this.utils, date, before) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, before) }; | ||
return { pass: false, message: failMessage(this.utils, date, before) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, startDate, endDate) => () => | ||
matcherHint('.not.toBeBetween', 'received', '') + | ||
const passMessage = (utils, received, startDate, endDate) => () => | ||
utils.matcherHint('.not.toBeBetween', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be between ${printReceived(startDate)} and ${printReceived(endDate)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be between ${utils.printReceived(startDate)} and ${utils.printReceived(endDate)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, startDate, endDate) => () => | ||
matcherHint('.toBeBetween', 'received', '') + | ||
const failMessage = (utils, received, startDate, endDate) => () => | ||
utils.matcherHint('.toBeBetween', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be between ${printReceived(startDate)} and ${printReceived(endDate)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be between ${utils.printReceived(startDate)} and ${utils.printReceived(endDate)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeBetween(date, startDate, endDate) { | ||
const pass = predicate(date, startDate, endDate); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, startDate, endDate) }; | ||
return { pass: true, message: passMessage(this.utils, date, startDate, endDate) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, startDate, endDate) }; | ||
return { pass: false, message: failMessage(this.utils, date, startDate, endDate) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = received => () => | ||
matcherHint('.not.toBeBoolean', 'received', '') + | ||
const passMessage = (utils, received) => () => | ||
utils.matcherHint('.not.toBeBoolean', 'received', '') + | ||
'\n\n' + | ||
'Expected value to not be of type boolean, received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = received => () => | ||
matcherHint('.toBeBoolean', 'received', '') + | ||
const failMessage = (utils, received) => () => | ||
utils.matcherHint('.toBeBoolean', 'received', '') + | ||
'\n\n' + | ||
'Expected value to be of type boolean, received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeBoolean(received) { | ||
const pass = predicate(received); | ||
if (pass) { | ||
return { pass: true, message: passMessage(received) }; | ||
return { pass: true, message: passMessage(this.utils, received) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(received) }; | ||
return { pass: false, message: failMessage(this.utils, received) }; | ||
} |
Oops, something went wrong.