Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 1.21 KB

run-request-tests.md

File metadata and controls

30 lines (22 loc) · 1.21 KB

How to run the tests of Requests for Request-Promise

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:

  1. Create a temporary folder.
  2. Clone Request into the temporary folder and run npm install.
  3. Clone Request-Promise into the temporary folder and run npm install.
  4. Rename temp/request/index.js to temp/request/index-orig.js.
  5. 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/')
  1. Go to temp/request-promise/lib/rp.js
  2. Comment out the var request = stealthyRequire('request'); line.
  3. Add var request = require('../../request/index-orig.js'); right below.
  4. 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.