Closed Bug 1473569 Opened 3 years ago Closed 3 years ago

Screenshot unit test does not fail on unexpected error messages

Categories

(DevTools :: Console, enhancement, P2)

enhancement

Tracking

(firefox63 fixed)

RESOLVED FIXED
Firefox 63
Tracking Status
firefox63 --- fixed

People

(Reporter: ystartsev, Assigned: ystartsev)

References

Details

Attachments

(1 file)

I noticed while working on the screenshot unit tests that it was not failing if the expectedError was different from what the error was throwing. I haven't had time to investigate this but it looks like this is fixed in 1452706

The errors now need to be verified to ensure that the behavior is correct
Comment on attachment 8990338 [details]
Bug 1473569 - fix faulty errors in formatCommand;

https://reviewboard.mozilla.org/r/255380/#review262414

Thanks yulia !

::: devtools/server/actors/webconsole/commands.js:164
(Diff revision 1)
>  }
>  
>  function hasUnexpectedChar(value, char, rightOffset, leftOffset) {
>    const lastPos = value.length - 1;
> -  value.slice(rightOffset, lastPos - leftOffset).includes(char);
> +  const string = value.slice(rightOffset, lastPos - leftOffset);
> +  dump(`\n${string}\n`);

nit: oopsie

::: devtools/server/actors/webconsole/commands.js:170
(Diff revision 1)
> +  const index = string.indexOf(char);
> +  if (index === -1) {
> +    return false;
> +  }
> +  const prevChar = index > 0 ? string[index - 1] : null;
> +  return prevChar !== "\\";

nit: could we add a comment to explain why we do that ?

::: devtools/server/actors/webconsole/commands.js:177
(Diff revision 1)
>  
>  function collectString(token, tokens, index) {
>    const firstChar = token.value[0];
>    const isString = isStringChar(firstChar);
> +  const UNESCAPED_CHAR_ERROR =
> +    `String has unescaped \`${firstChar}\` character, may miss a space between arguments`;

should we add the faulty string here ? since you can pass multiple argument, it may be hard to spot where you did something wrong.
Attachment #8990338 - Flags: review?(nchevobbe) → review+
Pushed by ystartsev@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3ef659a44ba3
fix faulty errors in formatCommand; r=nchevobbe
https://hg.mozilla.org/mozilla-central/rev/3ef659a44ba3
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
You need to log in before you can comment on or make changes to this bug.