Request-Promise aims to be almost identical to Request. Therefore most tests for Request should also be green executed against Request-Promise.
This is how to run the tests:
- Create a temporary folder.
- Clone Request into the temporary folder and run
npm install
. - Clone Request-Promise into the temporary folder and run
npm install
. - Rename temp/request/index.js to temp/request/index-orig.js.
- Create temp/request/index.js with the following content:
'use strict'
//module.exports = require('./index-orig.js')
var BPromise = require('../request-promise/node_modules/bluebird')
BPromise.onPossiblyUnhandledRejection(function (err) {
return err
})
module.exports = require('../request-promise/')
- Go to temp/request-promise/lib/rp.js
- Comment out the
var request = stealthyRequire('request');
line. - Add
var request = require('../../request/index-orig.js');
right below. - Go to temp/request/ and run
npm test
.
Currently, only those tests fail that expect a request call to throw an exceptions. Request-Promise rejects the promise for those errors instead.