Commit 2969055a authored by Savas Vedova's avatar Savas Vedova

Merge branch '351382-fix-undefined-this-in-toMatchInterpolatedText' into 'master'

Fix undefined this in toMatchInterpolatedText, clearer error message

See merge request gitlab-org/gitlab!79386
parents 7eb3c90b 809afbcc
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