From 2dc3ec756e3807dee12ad9c4b601f8febbbd5e00 Mon Sep 17 00:00:00 2001 From: osher Date: Tue, 30 Aug 2016 17:19:28 +0300 Subject: [PATCH 1/3] Clarify that `.end(..)` closes the server --- Readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Readme.md b/Readme.md index 5beaa6b7..92a48c72 100644 --- a/Readme.md +++ b/Readme.md @@ -84,6 +84,8 @@ describe('GET /users', function() { Expectations are run in the order of definition. This characteristic can be used to modify the response body or headers before executing an assertion. + + Also - if you are using the `.end()` method - it closes the server, even if you initially provided it running. ```js describe('GET /user', function() { @@ -210,6 +212,7 @@ 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. ## Notes From f590746877f210bbed186850e6fb4761fc790b85 Mon Sep 17 00:00:00 2001 From: osher Date: Tue, 30 Aug 2016 17:27:29 +0300 Subject: [PATCH 2/3] clarify about the `this` in cb of `,e --- Readme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 92a48c72..3a7ff28d 100644 --- a/Readme.md +++ b/Readme.md @@ -81,11 +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. - Also - if you are using the `.end()` method - it closes the server, even if you initially provided it running. ```js describe('GET /user', function() { @@ -213,6 +215,7 @@ describe('request.agent(app)', function(){ 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. ## Notes From 52a53826fe2913ff58d2129b3ed232e70c52b072 Mon Sep 17 00:00:00 2001 From: osher Date: Sun, 24 Sep 2017 10:29:50 +0300 Subject: [PATCH 3/3] fixing typo --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 3a7ff28d..1a3460f2 100644 --- a/Readme.md +++ b/Readme.md @@ -215,7 +215,7 @@ describe('request.agent(app)', function(){ 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. + 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