这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ describe('GET /users', function() {
});
});
```
Also mind:
- if you are using the `.end()` method - it closes the server, even if you initially provided it running.
- the `this` keyword in the callback passed to `.end()` is the instance of `supertest.Test` class that manages the test.

Expectations are run in the order of definition. This characteristic can be used
to modify the response body or headers before executing an assertion.


```js
describe('GET /user', function() {
Expand Down Expand Up @@ -210,6 +214,8 @@ describe('request.agent(app)', function(){
### .end(fn)

Perform the request and invoke `fn(err, res)`.
If the call was created with an instance of a server - it **closes** the server, wether it was bound to a port or not.
Also mind that the `this` context inside the callback is set to the `supertest.Test` instance, and not the mocha test or any other context you're running in.

## Notes

Expand Down