gstroup / apimocker

node.js module to run a simple http server for mock service responses.
MIT License
280 stars 81 forks source link

"TypeError: jsonPath.eval is not a function" is thrown when `JSONPath` is not installed. #97

Closed twalker closed 5 years ago

twalker commented 5 years ago

The JSONPath dependency is not consistently installed with npm version v5+ It intermittently installs correctly, often on the 2nd attempt to npm install in a project dependent on apimocker. There appears to be a known issue with JSONPath and npm:

(This package is being moved to "jsonpath-plus" to avoid npm problems in dealing with upper-case packages.)

When JSONPath is not installed during the install of apimocker, requests to apimocker throw a "TypeError: jsonPath.eval is not a function". In addition to JSONPath not installing consistently, the JSONPath.eval method used by apimocker has been deprecated.

To reproduce

  1. npm install
  2. npm test

Actual results: "JSONPath.eval is not a function" errors are thrown and cause the tests to fail. If the error does not occur, try re-installing and run the tests again:

rm -rf node_modules
npm install
npm test

Expected results: Tests to pass consistently after every npm install

gstroup commented 5 years ago

fixed in v1.0.4