Home > front end >  Prevent "t.expect(log).contains('string', 'message')" from printing lo
Prevent "t.expect(log).contains('string', 'message')" from printing lo

Time:12-08

I have a test that looks for ~100 separate substrings of a large log file, and fails if any of the strings is not present. Each time a not-present string is found, I emit a message saying which one. However, the log file is also put into the output log, and it is pretty large. How can I prevent it from being printed?

CodePudding user response:

TestCafe does not allow removing an error message from a report. However, you can rewrite your assertion in the following way to hide the expected string:

const logContains = log.includes(myString);

await t.expect(logContains).ok(`The log file does not contain the following string: "..."`);
  • Related