IBM / report-toolkit

A toolkit for consumers of Node.js diagnostic Reports
https://ibm.github.io/report-toolkit
Other
84 stars 10 forks source link

fix: json-ptr version compatibility #101

Closed CatsMiaow closed 3 years ago

CatsMiaow commented 3 years ago
npm i -g report-toolkit
rtk diff report1.json report2.json

/Test/node/lib/node_modules/report-toolkit/node_modules/rxjs/internal/util/hostReportError.js:4
    setTimeout(function () { throw err; }, 0);
                             ^

TypeError: ptr.get is not a function
    at /Test/node/lib/node_modules/report-toolkit/node_modules/@report-toolkit/diff/dist/report-toolkit-diff.cjs.js:90:28
    at /Test/node/lib/node_modules/report-toolkit/node_modules/lodash/fp/_baseConvert.js:34:28
    at arrayEach (/Test/node/lib/node_modules/report-toolkit/node_modules/lodash/_arrayEach.js:15:9)
    at forEach (/Test/node/lib/node_modules/report-toolkit/node_modules/lodash/forEach.js:38:10)
    at wrapper (/Test/node/lib/node_modules/report-toolkit/node_modules/lodash/_createHybrid.js:87:15)
    at Object.<anonymous> (/Test/node/lib/node_modules/report-toolkit/node_modules/lodash/fp/_baseConvert.js:455:19)
    at apply (/Test/node/lib/node_modules/report-toolkit/node_modules/lodash/_apply.js:15:25)
    at Object.wrapper [as forEach] (/Test/node/lib/node_modules/report-toolkit/node_modules/lodash/_createCurry.js:41:12)
    at Observable._subscribe (/Test/node/lib/node_modules/report-toolkit/node_modules/@report-toolkit/diff/dist/report-toolkit-diff.cjs.js:63:16)
    at Observable._trySubscribe (/Test/node/lib/node_modules/report-toolkit/node_modules/rxjs/internal/Observable.js:44:25)

The reason I am getting the above error is because the json-ptr version is installed as v1.3.2 when installing the module. The export has changed in json-ptr v1.3.0

https://github.com/flitbit/json-ptr#releases In version v1.3.0 of the library, global functions were moved to static functions of the JsonPointer class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.

This PR is a fix that maintains compatibility with json-ptr v1.2.0 and v1.3.2 Passed npm test in both versions.

codecov[bot] commented 3 years ago

Codecov Report

Merging #101 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #101   +/-   ##
=======================================
  Coverage   86.10%   86.10%           
=======================================
  Files          51       51           
  Lines         914      914           
=======================================
  Hits          787      787           
  Misses        127      127           
Impacted Files Coverage Δ
packages/diff/src/index.js 95.12% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f009e70...8fee0ef. Read the comment docs.

boneskull commented 3 years ago

thanks. sorry, I didn't see this before I fixed it. fixed in v0.6.1