Commit 809afbcc authored by Vamsi Vempati's avatar Vamsi Vempati Committed by Savas Vedova

Fix undefined this in toMatchInterpolatedText, clearer error message

parent 2c753f80
export const toMatchInterpolatedText = (received, match) => {
// Custom matchers are object methods and should be traditional functions to be able to access `utils` on `this`
export function toMatchInterpolatedText(received, match) {
let clearReceived;
let clearMatch;
......@@ -15,16 +16,14 @@ export const toMatchInterpolatedText = (received, match) => {
const pass = clearReceived === clearMatch;
const message = pass
? () => `
\n\n
Expected: ${this.utils.printExpected(clearReceived)}
To not equal: ${this.utils.printReceived(clearMatch)}
Expected to not be: ${this.utils.printExpected(clearMatch)}
Received: ${this.utils.printReceived(clearReceived)}
`
: () =>
`
\n\n
Expected: ${this.utils.printExpected(clearReceived)}
To equal: ${this.utils.printReceived(clearMatch)}
Expected to be: ${this.utils.printExpected(clearMatch)}
Received: ${this.utils.printReceived(clearReceived)}
`;
return { actual: received, message, pass };
};
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment