hhvm / hacktest

A unit testing framework for Hack
MIT License
29 stars 12 forks source link

Pretty-print context on failures #91

Closed fredemmott closed 4 years ago

fredemmott commented 4 years ago

Concise first, then verbose:

refs #18

Screen Shot 2019-11-01 at 4 08 52 PM

fredemmott commented 4 years ago

FWIW hh-clilib doesn't currently provide a color abstraction as I'm waiting for XHP namespaces first

fredemmott commented 4 years ago

do we want the full stack trace in non-verbose mode? maybe just the last part (prettyprinted relevant line from the test file) would be enough

not specific to this PR but eventually it would be nice to have some way to write regression tests for these -- maybe adding a .expect file for everything in tests/dirty? then it shouldn't be too hard to write a test that runs a dirty test and compares the output, and we could add new dirty test cases for all these output fixes/improvements...

The changes on 2.0 should allow doing this better: can either directly observe events, or create an instance of the CLI class with fake stdin/out and assert them.

I'd like to get rid of tests/dirty entirely - but that probalby needs a little more refactoring so we can just do "run these test lambdas" rather than 'run whatever's in these files/directories'