Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ospec: use string substitution to expose values in assertion reports #31

Open
barneycarroll opened this issue Jan 13, 2021 · 4 comments
Assignees

Comments

@barneycarroll
Copy link
Member

ospecs messaging processes assertion values differently depending on environment. Under Node it uses util.inspect, the platforms preferred tool for debugging; but in the browser it falls back to a loosely opinionated custom process for stringifying values.

Browser consoles are much richer than Nodes' terminal output and could be better served by making use of string substitution, which allow intelligent representations of complex entities - see below for current vs suggested behaviour for exotic objects logged by ospec in Chrome

image

Happy to implement this myself.

@pygy
Copy link
Member

pygy commented Jan 15, 2021

I would have transferred this to MithrilJS/ospec, but I've been stripped of my admin rights...

What gives @isiahmeadows? I'm not exactly active, but I don't remember stepping down either.

@pygy
Copy link
Member

pygy commented Jan 15, 2021

This would require keeping structured assertion results, rather than strigifying on the fly as we do now...

The results are exposed to custom reporters, and some people take advantage of this, so the custom stringification will have to be kept around until the next major version.

@barneycarroll
Copy link
Member Author

I agree ospec reporting data shouldn’t be contingent on output APIs but I feel it should be easy enough to change the shape of the records to store the assertion operands — the (re)substitution could then take place as a runtime operation in o.report.

@pygy pygy transferred this issue from MithrilJS/mithril.js Jan 18, 2021
@pygy
Copy link
Member

pygy commented Jan 18, 2021

Agreed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants