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 clearReceived;
let clearMatch; let clearMatch;
...@@ -15,16 +16,14 @@ export const toMatchInterpolatedText = (received, match) => { ...@@ -15,16 +16,14 @@ export const toMatchInterpolatedText = (received, match) => {
const pass = clearReceived === clearMatch; const pass = clearReceived === clearMatch;
const message = pass const message = pass
? () => ` ? () => `
\n\n Expected to not be: ${this.utils.printExpected(clearMatch)}
Expected: ${this.utils.printExpected(clearReceived)} Received: ${this.utils.printReceived(clearReceived)}
To not equal: ${this.utils.printReceived(clearMatch)}
` `
: () => : () =>
` `
\n\n Expected to be: ${this.utils.printExpected(clearMatch)}
Expected: ${this.utils.printExpected(clearReceived)} Received: ${this.utils.printReceived(clearReceived)}
To equal: ${this.utils.printReceived(clearMatch)}
`; `;
return { actual: received, message, pass }; 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