| Index: test/_common.js |
| =================================================================== |
| --- a/test/_common.js |
| +++ b/test/_common.js |
| @@ -414,16 +414,34 @@ |
| Date: { |
| now: () => currentTime |
| } |
| }; |
| }; |
| console.warn = console.log; |
| +exports.silenceWarnOutput = function(test, msg) |
| +{ |
| + let warnHandler = globals.console.warn; |
| + globals.console.warn = s => |
| + { |
| + if (s != msg) |
| + warnHandler(s); |
| + }; |
| + try |
| + { |
| + return test(); |
| + } |
| + finally |
| + { |
| + globals.console.warn = warnHandler; |
| + } |
| +}; |
| + |
| exports.silenceAssertionOutput = function(test, msg) |
| { |
| let msgMatch = new RegExp(`^Error: ${msg}[\r\n]`); |
| let errorHandler = globals.console.error; |
| globals.console.error = s => |
| { |
| if (!msgMatch.test(s)) |
| errorHandler(s); |