monkey-patch console.log and console.warn for all tests #11265
                
     Merged
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
At present we do one of two things with logs in tests:
console.logandconsole.warnon a per-test basis. this involves lots of repetitious ugly codelog.jsfile that exports alogarray and dolog.pushinstead ofconsole.log. this is also repetitious (and requires abefore_testorafter_testhook to reset between different test modes), and is particularly annoying because in order to quickly try something out in the playground you need to rewrite the test if you want to actually see the logsThis PR makes things much simpler: we can access
logsandwarningsdirectly inside thetestfunction.If something gets logged before the test runs, and the test doesn't use
logs, then the logs get stashed away, and replayed when eitherconsole.logis first called inside the test or, if that doesn't happen, after the test has run, meaning that temporary logs will always be visible and in the correct order.Draft because I haven't yet converted all the tests that use the old way of doing things