Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that .end(..) closes the server #369

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Readme.md
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 teh callback is set to the `supertest.Test` instance, and not the mocha test or any other context you're running in.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

teh

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo, inside teh callback should be inside the callback

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG. you're right. fixing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well... till the next cleanup ... I guess... 😛

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¯_(ツ)_/¯ it happens. Thanks for fixing it!


## Notes

Expand Down