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

[istanbul-lib-instrument] "don't know how to turn this value into a node" exception during instrumentation #672

Open
wkeese opened this issue Feb 10, 2022 · 4 comments
Labels

Comments

@wkeese
Copy link

wkeese commented Feb 10, 2022

I'm getting the

don't know how to turn this value into a node

exception during instrumentation and I traced it down to this:

Visitor.js' exit() method calls babel/@type's valueToNode(coverageData) method. The coverageData.inputSourceMap property used to be a plain object, but (I think because of a newer version of babel?), inputSourceMap is now an instance of the SourceMap class, causing valueToNode() to throw that exception.

I know this is similar to #646 but we aren't using Angular. I am using https://github.com/JS-DevTools/coverage-istanbul-loader, perhaps I should be using https://github.com/istanbuljs/babel-plugin-istanbul instead. I am wondering though how or if this is working for other configurations, and if istanbul-lib-instrument needs an update to handle coverageData.inputSourceMap being a SourceMap?

@andrevmatos
Copy link

Also getting this with vue-cli

@andrevmatos
Copy link

May have been fixed by babel/babel#14283

@thebanjomatic
Copy link

thebanjomatic commented Feb 17, 2022

It looks like the sourcemap is being grabbed from file.inputMap.sourcemap in babel-plugin-istanbul here:
https://github.com/istanbuljs/babel-plugin-istanbul/blob/99bd2a27493b7552ae75877496c3b2ad93f5fc46/src/index.js#L114-L116

That seems like an ideal place to convert to a plain javascript object. It sounds like the babel team would like to not make a copy of the sourcemap every time they are generated.

@JamesCatt
Copy link

Also seeing this with vue-cli, although it only seems to happen with components using script setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants