twoLeftFeet
twoLeftFeet

Reputation: 720

JestJS Tests failing internally with request-promise-core

All of my jest tests are suddenly failing. I am testing es6 code.

Here is my package.json devDepenencies:

"devDependencies": {
"babel-eslint": "^8.1.2",
"babel-jest": "^22.0.4",
"babel-preset-es2015": "^6.24.1",
"can-connect": "^1.5.14",
"can-fixture": "^1.2.2",
"documentjs": "^0.5.1",
"eslint": "^4.14.0",
"http-server": "^0.10.0",
"jest": "^22.0.4",
"jquery": "^3.2.1",
"jquery-ui": "^1.12.1",
"json-pretty-html": "^1.0.2",
"regenerator-runtime": "^0.11.1",
"steal-css": "^1.3.1",
"steal-less": "^1.2.2",
"steal-stache": "^3.1.3",
"steal-tools": "^1.10.0"
},

The error in each test comes from the file request-promise-core/configure/request2 on 34:48:

Cannot read property 'prototype' of undefined.

var originalInit = options.request.Request.prototype.init;

options.request.Request is undefined if I launch the node debugger tool. Has anyone run into this before?

The full error stack is:

 FAIL  util\field\parseFieldArray\parseFieldArray.test.js
  ● Test suite failed to run

TypeError: Cannot read property 'prototype' of undefined

  at module.exports (node_modules/request-promise-core/configure/request2.js:34:48)
  at Object.<anonymous> (node_modules/request-promise-native/lib/rp.js:15:1)
  at Object.<anonymous> (node_modules/jsdom/lib/api.js:6:17)

Upvotes: 0

Views: 735

Answers (2)

TanNguyen
TanNguyen

Reputation: 11

Try with npm install --save-dev request

Upvotes: 1

twoLeftFeet
twoLeftFeet

Reputation: 720

The issue with this particular problem wasn't really anything I was doing. I had some package dependencies that weren't working when imported.

Upvotes: 0

Related Questions