Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Jan 15, 2022
Merged

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

merged 1 commit into from Jan 15, 2022

Conversation

lamweili
Copy link
Contributor

@lamweili lamweili commented Jan 15, 2022

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 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
8 checks passed
@lamweili lamweili deleted the update-deps branch Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant