I have a Vue project and whenever I try to do a test coverage I run into the following error; TypeError: Cannot read properties of null (reading 'split'). I have tested it on 0.34.1, 0.34.6 and 1.0.1... The culprit which causes the error would be in the file: removeQueryParameters node_modules/@vitest/coverage-istanbul/dist/provider.js:294:19
function removeQueryParameters(filename) {
return filename.split("?")[0];
}
I could resolve this by putting an if statement around the return, but am rather curious whether there is a version of istanbul which doesn't have this bug (yet), or whether I could have possibly misonfigured settings and merely suppressing the "error" by using the if statement.
My env:
"nuxt": "^3.7.3",
"nuxt-vite": "^0.3.5",
"nuxt-vitest": "^0.10.5",
"@types/jest": "^29.5.4",
Use
?operator after filename. So it will check if file name exists before going tosplit()[0]