Elegant approach to filter stdout contents to file? Or to turn off Mocha's watching spinner?

I'm using mocha -w for continuous testing.

I've run into a bug with another lib's socket connections that only occurs when using mocha -w for an extended time. I need to capture debug output that is directed to console.log into a file, so that the massive amount of data can be searched and filtered for use in troubleshooting.

However, mocha's "watching" spinner is getting in the way. When I try to redirect stdout to a file using Windows power shell, GitHub's Git Shell, or DOS:

mocha -w >> log.txt

I get GBs of data like this from the animated spinner:

[0G [96m| [90mwatching[0m[0G [96m/ [90mwatching[0m[0G [96m- [90mwatching[0m[0G [96m\ [90mwatching[0m[0G [96m| [90mwatching[0m[0G [96m/ [90mwatching[0m[0G [96m- [90mwatching[0m[0G [96m\ [90mwatching[0m[0G [96m| [90mwatching[0m[0G [96m/ [90mwatching[0m[0G [96m- [90mwatching[0m[0G [96m\ [90mwatching[0m[0G [96m| [90mwatching[0m[0G [96m/ [90mwatching[0m[0G [96m- [90mwatching[0m[0G [96m\ [90mwatching[0m[0G [96m| [90mwatching[0m[0G [96m/ [90mwatching[0m[0G [96m-

This SO question suggests making a copy of Mocha and hacking the play() method. However, it's less than ideal to try and troubleshoot what is likely a Mocha bug by using a hacked version of Mocha.

So it seemed like a good time to expand my shell knowledge and node.js knowledge.

Is there an elegant way to do any of the following?

  1. filter lines out of the file when they begin with the animation control character?
  2. prevent mocha from rendering the spinner text? (there don't seem to be any flags, as demonstrated by docs and bugs like this one, which never suggest flipping a flag for a workaround)

I'm not familiar with mocha or its output but in theory you should be able to filter like so:

mocha -w | Where {$_ -notmatch 'watching\['} >> log.txt

Adjust the regex ('matching[') to best suit the output you are trying to filter out.