Skip to content

Commit

Permalink
Prepare 3.0.0 release. Small readme updates, update dev libs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelax committed Jan 30, 2017
1 parent 1d82e5b commit 199506d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
7 changes: 7 additions & 0 deletions History.md
@@ -1,3 +1,10 @@
3.0.0 / 2017-01-29
===================

* PR-373 - Allow TestAgent pass a cert and key to request (thanks @toefraz)
* PR-392 - Update readme with promise example (thanks @ajouve)
* PR-400 - Update to superagent 3 (thanks @alphashuro)

2.0.1 / 2016-10-19
===================

Expand Down
33 changes: 16 additions & 17 deletions Readme.md
Expand Up @@ -26,10 +26,10 @@ npm install supertest --save-dev
test framework at all:

```js
var request = require('supertest');
var express = require('express');
const request = require('supertest');
const express = require('express');

var app = express();
const app = express();

app.get('/user', function(req, res) {
res.status(200).json({ name: 'tobi' });
Expand Down Expand Up @@ -147,39 +147,38 @@ request.get('/').expect('heya', function(err){
Here's an example with mocha that shows how to persist a request and its cookies:

```js
var request = require('supertest');
var should = require('should');
var express = require('express');
var cookieParser = require('cookie-parser');
const request = require('supertest');
const should = require('should');
const express = require('express');
const cookieParser = require('cookie-parser');


describe('request.agent(app)', function(){
var app = express();
describe('request.agent(app)', function() {
const app = express();
app.use(cookieParser());

app.get('/', function(req, res){
app.get('/', function(req, res) {
res.cookie('cookie', 'hey');
res.send();
});

app.get('/return', function(req, res){
app.get('/return', function(req, res) {
if (req.cookies.cookie) res.send(req.cookies.cookie);
else res.send(':(')
});

var agent = request.agent(app);
const agent = request.agent(app);

it('should save cookies', function(done){
it('should save cookies', function(done) {
agent
.get('/')
.expect('set-cookie', 'cookie=hey; Path=/', done);
})
});

it('should send cookies', function(done){
it('should send cookies', function(done) {
agent
.get('/return')
.expect('hey', done);
})
});
})
```
There is another example that is introduced by the file [agency.js](https://github.com/visionmedia/superagent/blob/master/test/node/agency.js)
Expand Down
12 changes: 6 additions & 6 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "supertest",
"version": "2.0.1",
"version": "3.0.0",
"description": "SuperAgent driven library for testing HTTP servers",
"main": "index.js",
"scripts": {
Expand All @@ -9,19 +9,19 @@
},
"dependencies": {
"superagent": "^3.0.0",
"methods": "1.x"
"methods": "~1.1.2"
},
"devDependencies": {
"body-parser": "~1.15.0",
"body-parser": "~1.16.0",
"cookie-parser": "~1.4.1",
"eslint": "^3.8.1",
"eslint": "^3.14.1",
"eslint-config-airbnb": "^12.0.0",
"eslint-plugin-import": "1.16.0",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-react": "6.4.1",
"express": "~4.14.0",
"mocha": "~3.1.2",
"should": "~11.1.1"
"mocha": "~3.2.0",
"should": "~11.2.0"
},
"engines": {
"node": ">=4.0.0"
Expand Down

0 comments on commit 199506d

Please sign in to comment.