Expand .with message to include actual results#52
Expand .with message to include actual results#52robcolburn wants to merge 1 commit intochaijs:mainfrom
Conversation
3293a5e to
5b9a0b3
Compare
|
@robcolburn Thank you for the PR and a thousand apologies for the delay :D I like where you're going with this, and I agree with your conclusion that
Also, I'm not sure how I feel about the lack of indentation on the newlines for each call. I think I could go either way, but I feel myself leaning toward wanting a 2 or 4 space indentation. What are your thoughts? @keithamus? @imjacobclark? (Note: We'd definitely want the final solution to include tests as well!) |
|
Personally, I think this is excellent, anything that outputs what actually happened to track down why the test failed is a huge +1. |
|
|
@robcolburn I'm still not sure how I feel about indentation vs no-indentation. But if indentation were to be added, I think it might be as easy as changing: return '\ncall #' + (i + 1)to return '\n call #' + (i + 1)Ideally, there should be a test added for each new message format that you've added, verifying the actual |
|
@meeber, |
|
@robcolburn I think that looks fine without any indentation on the "call". |
|
@robcolburn hey - have you had any time to look into this recently? I think it'd be great to get this updated and merged in! |
|
@keithamus I think it would be more preferable to enable such behavior via configuration option. Something like
|
|
@stalniy I disagree. I much prefer plugins to have zero configuration. It is too high a burden on the user to curate a configuration to their needs; overall we are trying to make chai (and plugins) more usable and less configuration based. The messages here could use some work, but they are a good start to making chai spies much more usable. |
I ❤️
chai-spiesespeciallywith, but I found the output left me wanting a bit more. For a long while, I would just write in some hacky stuff manually. But, enough is enough, it's time to do something about it.I dug into
#{act}, like #29 did. It's cool API, you just pass in another argument likecallstothis.assertto get it working. But, I couldn't get it do anything helpful info for me. My hack still produced better data because I usually have somewhat deep object I need to validate (I really need something like chai's equal with the whole +/- thing). So, I did the next best thing I could. I found chai has (a wrapper for Node'sinspect) which it uses a lot internally, and I brought into our message. This gets a little chatty, especially since my messages are more wordy, but I find I want more data when these things go wrong.So, what does it look like?