jfairbank / redux-saga-test-plan

Test Redux Saga with an easy plan.
http://redux-saga-test-plan.jeremyfairbank.com
MIT License
1.25k stars 127 forks source link

Reduce ASCII styling in errors #318

Open cefn opened 4 years ago

cefn commented 4 years ago

In the test environment I use (VSCode) test errors are added as virtual 'comments' next to the code on the assertion line which threw the error. If the assertion error is multiline, then the newlines are removed to render the error in a single line.

The ASCII horizontal rule layout dictated by https://github.com/jfairbank/redux-saga-test-plan/blob/master/src/expectSaga/expectations.js#L119 causes the error to be unreadable.

It's hard to give the full impression here in the ticket but all the useful information is pushed off the screen by the horizontal rules, which compounds the verbose message.

Compare...

-----------------------------------{ grandparent: { parent: { child: 'bar' } } }But instead had final store state:----------------------------------{ grandparent: { parent: { child: undefined } } }Jest

To the preferable...

{ grandparent: { parent: { child: 'bar' } } } but instead had final store state: { grandparent: { parent: { child: undefined } } }Jest

Or the improved message...

{ grandparent: { parent: { child: 'bar' } } } should be { grandparent: { parent: { child: undefined } } }