Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
deprecate project!
Browse files Browse the repository at this point in the history
SuperTest 2.0 supports proomises natively. Use that instead!
Fix #44.
  • Loading branch information
benesch committed Dec 29, 2016
1 parent a59f136 commit ab56510
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ breaking change. This changelog lists all meaningful changes in each
release; consult the main [README] to determine which changes are
breaking.

## --- / 2016-12-29

* SuperTest as Promised is deprecated. Thanks, [@jasisk]!

See the README for instructions on upgrading to SuperTest 2.0.

## 4.0.2 / 2016-11-02

* [[#39]] Bring list of breaking changes in the [README] up-to-date. Thanks, [@karlbecker]!
Expand Down Expand Up @@ -100,6 +106,7 @@ Thanks, [@srussellextensis]!
[@bbatha]: https://github.com/bbatha
[@karlbecker]: https://github.com/karlbecker
[@mkasberg]: https://github.com/mkasberg
[@jasisk]: https://github.com/jasisk
[@jsdevwork]: https://github.com/jsdevwork
[@srussellextensis]: https://github.com/srussellextensis
[@sylvaingi]: https://github.com/sylvaingi
Expand Down
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,58 @@
align="right" valign="top" alt="Build Status">
</a>

**This project is deprecated!** As of v2.0.0, [SuperTest] has native
support for promises. **Don't use SuperTest as Promised in new projects**;
use SuperTest directly!

If you're currently using SuperTest as Promised, here's how to switch to
native SuperTest:

* SuperTest returns only ES6 promises. SuperTest as Promised, by
contrast, returns [Bluebird] promises by default, or promise
objects from a library of your choosing using [BYOP
support](#byop-bring-your-own-promise). Every promise library worth
its salt supports ES6 promise interop, though, so it should be a
small matter to cast ES6 promises to your custom promise library's
promises. Here's a simple SuperTest as Promised snippet that relies
on the `.delay` method of Bluebird promises

```js
var request = require("supertest-as-promised");

request(app)
.get("/kittens")
.expect(201)
.toPromise()
.delay(10)
.then(function (res) { /* ... */ })
```

that can be trivially converted to use SuperTest 2.0 like so:

```js
var request = require("supertest");
var BluebirdPromise = require("bluebird");
BluebirdPromise.resolve(
request(app)
.get("/kittens")
.expect(201))
.delay(10)
.then(function (res) { /* ... */ })
```

* SuperTest does not ship a `.toPromise` method. You'll need to
remove calls to this method. You were probably using `.toPromise`
because you wanted a proper Promise object.
`YourPromiseLibrary.resolve(...)` will probably do the trick; see
the example above.
SuperTest as Promised will continue to receive bugfixes, but no new
features. Cheers, folks! It's been a good two years.

## Overview

SuperTest as Promised supercharges [SuperTest] with a `then` method.

Instead of layering callbacks on callbacks in your tests:
Expand Down

0 comments on commit ab56510

Please sign in to comment.