Socket
Book a DemoInstallSign in
Socket

promisify-supertest

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promisify-supertest

SuperTest + Promises

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

promisify-supertest

npm version Build Status Dependency Status devDependency Status peerDependency Status

SuperTest + Promises. Uses native promises instead of bluebird.

Installation:

npm i -D promisify-supertest

Usage

It's a drop-in replacement for SuperTest

var request = require('promisify-supertest'); 

Also, it modifies the main supertest module handy with ES2015:

import 'promisify-supertest';
import request from 'supertest'; // Still promisified.

Then, just omit a callback, and it returnes a promise

request(app)
	.get('/')
	.end()
	.then(function(res) { // blah blah blah })
	.catch(function(err) { throw err; });

// But this still works too:
request(app)
	.get('/')
	.end(function(err, res) {
		if (err) throw err;
		// blah blah blah
	});

Contributing

PR's welcome!

Check in the issue tracker for issues, then file a fix one of them and send a PR!

Please make sure to have your code comply with standard (I know, but it was easy):

npm run lint

License

MIT: http://ariporad.mit-license.org

Keywords

SuperTest

FAQs

Package last updated on 31 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts