apache / cordova-fetch

Apache Cordova Fetch Library
https://cordova.apache.org/
Apache License 2.0
27 stars 27 forks source link

fix: cordova-fetch with npm@7 #91

Closed raphinesse closed 3 years ago

raphinesse commented 4 years ago

Motivation and Context

https://github.com/apache/cordova-lib/issues/859

Description

Instead of parsing the installed package's name out of the output of npm install <spec> (which does not work anymore with npm@7) we now do the following:

Both of these libraries are also used by npm itself.

Fetching the manifest can be expensive (e.g. for a git repo spec). But since pacote and npm share a cache and we always install a package after fetching a manifest anyway, the additional cost should be negligible in our case. Measuring the execution time of this repo's tests on my machine seems to confirm this: the time is roughly the same before and after this PR.

Furthermore this PR makes some adjustments to test expectations to handle minor behavior changes in npm@7.

Testing

TODO

codecov-io commented 4 years ago

Codecov Report

Merging #91 (dace3fc) into master (1d96eae) will increase coverage by 0.90%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
+ Coverage   92.42%   93.33%   +0.90%     
==========================================
  Files           1        1              
  Lines          66       60       -6     
==========================================
- Hits           61       56       -5     
+ Misses          5        4       -1     
Impacted Files Coverage Δ
index.js 93.33% <100.00%> (+0.90%) :arrow_up:

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 1d96eae...dace3fc. Read the comment docs.