dareid / dareid/chakram

Include response body to assertion errors

Open
#91 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
898
Forks
90
PR merge metrics
No merged PRs in 30d

Description

Hi Daniel,

I think that it might be nice to have an option (or a default) to automatically include responses to assertion error messages. It would make it possible to instantly see what the response actually is instead of going to the test source code and inserting temporary debug output for each failing test.

For now I obtained similar effect by defining
```js
const expect = (value, message) =>
chakram.expect(value, message || (value && JSON.stringify(value.body, null, 2)))
```
or
```js
const expect = (value, message) =>
chakram.expect(value, message || (value && util.inspect(value.body)))
```

I considered to include entire response object instead of only `.body`, but the output in this case appears to me to be too verbose.

Thanks

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the chakram.expect entry point and compare its current assertion-error construction with the wrapper examples in the issue. Decide whether the response body's JSON.stringify or util.inspect representation belongs behind an option or by default; done means failing assertions show the response body without temporary debug output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.