Skip to content

chore(deps-dev): bump nyc from 14.1.1 to 15.1.0#1140

Merged
lamweili merged 1 commit intomasterfrom
update-deps
Jan 15, 2022
Merged

chore(deps-dev): bump nyc from 14.1.1 to 15.1.0#1140
lamweili merged 1 commit intomasterfrom
update-deps

Conversation

@lamweili
Copy link
Contributor

nyc@^15.0.0 broke test/sandbox-coverage.js, hence some changes were required.

1. NYC constructor changed

@@ -48,8 +48,7 @@ function coverageFinder () {
=L48 L48   
=L49 L49   class NYC {
=L50 L50     constructor (config) {
-L51           config = config || {}
-L52           this.config = config
+    L51       this.config = { ...config }
=L53 L52   
=L54 L53       this.subprocessBin = config.subprocessBin || path.resolve(__dirname, './bin/nyc.js')

(https://github.com/istanbuljs/nyc/pull/1195/files#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346)

Thus, there is no more default config={}.
Existing code (below) resulted in Cannot read property 'subprocessBin' of undefined.

const nyc = new (require("nyc"))();

-L09     const nyc = new (require("nyc"))();
+L09     const nyc = new (require("nyc"))({});

2. instrumentSync change

@@ -18,24 +17,22 @@ function InstrumenterIstanbul (options) {
=L18 L17   })
=L19 L18 
=L20 L19   return {
-L21         instrumentSync (code, filename, sourceMap) {
-L22           var instrumented = instrumenter.instrumentSync(code, filename)
+L20         instrumentSync (code, filename, { sourceMap, registerMap }) {
+L21           var instrumented = instrumenter.instrumentSync(code, filename, sourceMap)
+L22           if (instrumented !== code) {
+L23             registerMap()
+L24           }
+L25     

(https://github.com/istanbuljs/nyc/pull/1195/files#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346)

instrumentSync now uses destructured parameters.
Existing code (below) resulted in Cannot destructure property 'sourceMap' of 'undefined' as it is undefined..

return nyc.instrumenter().instrumentSync(source, this.filename);

-L10     return nyc.instrumenter().instrumentSync(source, this.filename);
+L10     return nyc.instrumenter().instrumentSync(source, this.filename, { registerMap: () => {} });

@lamweili lamweili added the dependencies Pull requests that update a dependency file label Jan 15, 2022
@lamweili lamweili added this to the 6.4.0 milestone Jan 15, 2022
@lamweili lamweili merged commit 750c661 into master Jan 15, 2022
@lamweili lamweili deleted the update-deps branch January 15, 2022 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant