TylerLeonhardt / vscode-pester-test-adapter

MIT License
33 stars 13 forks source link

Handle verbose in scripts #41

Closed TylerLeonhardt closed 3 years ago

TylerLeonhardt commented 3 years ago

Now we filter out anything that happens before pester emits the json.

fixes #40

JustinGrote commented 3 years ago

As long as the verbose doesn't contain a '{', I was wondering how you were going to go about it because it was a headscratcher for me, guess I was overthinking it :)

TylerLeonhardt commented 3 years ago

As long as the verbose doesn't contain a '{',

Remember, Verbose starts with VERBOSE:

So that shouldn't ever be the case unless you literally emit a { to the pipeline or write-hosting...but at that point... Why are you doing that? 😆

JustinGrote commented 3 years ago

image

JustinGrote commented 3 years ago

@TylerLeonhardt actually found this regex while working on something else which may be useful to extract it out: https://regex101.com/r/H6PLlc/1

TylerLeonhardt commented 3 years ago

Interesting... It looks like that regex does work for your tests too.

That's probably the better way to go.

TylerLeonhardt commented 3 years ago

https://stackoverflow.com/a/4414453

so JS doesn't support (?R) that that regex uses... and this seems to be the workaround... https://blog.stevenlevithan.com/archives/javascript-match-nested

but wow... lots of code. I think I'll hold off on this until I run into someone who breaks my logic today.

JustinGrote commented 3 years ago

I imagine you could do a lot simpler non-recursive regex because you know the output will be in test json format, so you can just match on a few properties to be "good enough". Let me throw one together that should be JS compatible

JustinGrote commented 3 years ago

@TylerLeonhardt here's a simple one, it assumes that there won't be any output after the JSON (which there shouldn't be) https://regex101.com/r/XDymWd/1/

TylerLeonhardt commented 3 years ago

I adopted your regex in the latest version 😃