I think the problem must be with your code in `../app`. If you look at the example below, you'll see your same test code working correctly with a simple server. Without being to see your app code it's hard to see where the problem actually is...
Example code based on your test:
```javascript
'use strict';
const chai = require('chai');
const chaiHttp = require('chai-http');
const assert = chai.assert;
chai.use(chaiHttp);
const server = require('express')()
.use(require('body-parser').json())
.post('/', (req, res, next) => {
if (req.body.valid) {
res.status(200);
return res.send('OK');
}
res.status(400);
next(new Error('User error'));
});
describe('test', () => {
it('should do a 200 properly', (done) => {
chai.request(server)
.post('/')
.send({
valid: true
})
.end((err, res) => {
assert.equal(res.status, 200);
assert.equal(res.text, 'OK');
done();
});
});
it('should do a 400 properly', (done) => {
chai.request(server)
.post('/')
.send({
valid: false
})
.end((err, res) => {
assert.equal(res.status, 400);
assert.equal(/User error/.test(res.text), true);
done();
});
});
});
```
Output:
```bash
$ mocha js/chaiHTTP.js --reporter mochawesome
test
✓ should do a 200 properly (73ms)
✓ should do a 400 properly
Error: User error
at Layer.handle [as handle_request] (/home/robin/dev/workspace/Sandbox/node_modules/express/lib/router/layer.js:95:5)
at next (/home/robin/dev/workspace/Sandbox/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/robin/dev/workspace/Sandbox/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/robin/dev/workspace/Sandbox/node_modules/express/lib/router/layer.js:95:5)
at /home/robin/dev/workspace/Sandbox/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/home/robin/dev/workspace/Sandbox/node_modules/express/lib/router/index.js:335:12)
at next (/home/robin/dev/workspace/Sandbox/node_modules/express/lib/router/index.js:275:10)
at /home/robin/dev/workspace/Sandbox/node_modules/body-parser/lib/read.js:130:5
at invokeCallback (/home/robin/dev/workspace/Sandbox/node_modules/raw-body/index.js:224:16)
at done (/home/robin/dev/workspace/Sandbox/node_modules/raw-body/index.js:213:7)
at IncomingMessage.onEnd (/home/robin/dev/workspace/Sandbox/node_modules/raw-body/index.js:273:7)
at emitNone (events.js:105:13)
at IncomingMessage.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1047:12)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
at process._tickCallback (internal/process/next_tick.js:161:9)
2 passing (114ms)
[mochawesome] Report JSON saved to /home/robin/dev/workspace/Sandbox/mochawesome-report/mochawesome.json
[mochawesome] Report HTML saved to /home/robin/dev/workspace/Sandbox/mochawesome-report/mochawesome.html
```