Comments (14)
Are these introduced by the source map path rewrite?
from nyc.
No, we pass relPath
to the instrumentor instead of filename
. As I recall it isn't necessary, because most/all the reporters look for the longest common parent path and truncate to that.
It won't be an issue until someone tries to combine with coverage generated outside of nyc
from nyc.
Let's punt on the issue until the caching PR is merged. I don't want to rebase that again
from nyc.
fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open './src/helpers/Users/lifangzhou/Development/react-dynamic-element/src/helpers/__DEV__.js'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at LookupStore.Store.mix.get (/Users/lifangzhou/Development/react-dynamic-element/node_modules/nyc/node_modules/istanbul/lib/store/fslookup.js:40:19)
at HtmlReport.Report.mix.writeDetailPage (/Users/lifangzhou/Development/react-dynamic-element/node_modules/nyc/node_modules/istanbul/lib/report/html.js:411:67)
at /Users/lifangzhou/Development/react-dynamic-element/node_modules/nyc/node_modules/istanbul/lib/report/html.js:489:26
at SyncFileWriter.extend.writeFile (/Users/lifangzhou/Development/react-dynamic-element/node_modules/nyc/node_modules/istanbul/lib/util/file-writer.js:57:9)
at FileWriter.extend.writeFile (/Users/lifangzhou/Development/react-dynamic-element/node_modules/nyc/node_modules/istanbul/lib/util/file-writer.js:147:23)
at /Users/lifangzhou/Development/react-dynamic-element/node_modules/nyc/node_modules/istanbul/lib/report/html.js:488:24
at Array.forEach (native)
Maybe a related issue?
from nyc.
Got the same issue as @riophae : absolute path added after local dir. That's weird (something like './src/blah/Users/ME/MY/ENTIRE/PATH/TO/A/RELATIVE/FILE.js
)
from nyc.
Getting this issue when trying to report coverage to coveralls.
Does my full absolute path twice, so my actual path is /Users/qasim/blah/blah/index.js
, and nyc interprets it as ./Users/qasim/blah/blah/index.js
, making it think of it as /Users/qasim/blah/blah/Users/qasim/blah/blah/index.js
(incorrect).
from nyc.
The same with @qasim
from nyc.
@novemberborn I wonder if some of the fixes for paths outside the working directory might have made this problem more prevalent?
from nyc.
I can't really remember but I think I was doing something wrong, cause I don't have this issue anymore.
from nyc.
from nyc.
@novemberborn I wonder if some of the fixes for paths outside the working directory might have made this problem more prevalent?
I don't think so…? In any case just did #164.
@riophae @qasim could you try with that branch?
@MoOx the change to absolute paths should have fixed an issue with source map sources being absolute and not being resolved correctly against the relative coverage report. If you manage to reproduce the problem could you try with #164?
from nyc.
@novemberborn fixed with that branch 👍
from nyc.
fixed!
from nyc.
I'm still seeing this bug with remap-istanbul 0.11.0.
Specifically, we have our gulp target generate sourcemaps using gulp-sourcemaps (2.6.4) and a remapping function to put "../../src" in them (which is the path from the built file back to its source map). For example, we have a file at FULLPATH/src/util.ts, which generates JS at FULLPATH/build/src/util.js. In the .map file I see "sourceRoot":"../../src" correctly noted.
However, if I run remap-istanbul to generate the HTML coverage using:
cat coverage/coverage-final.json | ./node_modules/.bin/remap-istanbul --output html-report --type html
I get exceptions like:
Error: Could find source for : "src/FULLPATH/build/src/util.ts"
at CoverageTransformer.addFileCoverage (/FULLPATH/node_modules/remap-istanbul/lib/CoverageTransformer.js:176:18)
at /FULLPATH/node_modules/remap-istanbul/lib/CoverageTransformer.js:298:14
at Array.forEach (native)
at CoverageTransformer.addCoverage (/FULLPATH/node_modules/remap-istanbul/lib/CoverageTransformer.js:296:24)
at /FULLPATH/node_modules/remap-istanbul/lib/remap.js:51:13
at Array.forEach (native)
at remap (/FULLPATH/node_modules/remap-istanbul/lib/remap.js:50:16)
at Promise.then (/FULLPATH/node_modules/remap-istanbul/bin/remap-istanbul.js:133:21)
at process._tickCallback (internal/process/next_tick.js:109:7)
Note that if I switch our sourcemaps to generate absolute paths for sourceRoot ("sourceRoot"="/FULLPATH/src") instead, everything works, except that those .map files will only ever work on my personal machine (or another which happens to have the repo cloned to the same path).
Did this bug surface again, or is this separate from the previously reported 2016 issue?
from nyc.
Related Issues (20)
- Jest and Cypress's coverage merged results is wrong
- nyc should use nodejs module customization hooks rather than monkey patching
- Node v20: TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('128SIGINT') HOT 5
- Is there any way to extract/remove Babel from NYC?
- How to use nyc with TypeScript and ESM? HOT 1
- fix: merging two coverage reports for same source file causes crash HOT 1
- NYC checkCoverage doesn't have a way to throw error when insufficient coverage met
- nyc test coverage on branches is not accurate - Seems to be happening with nyc@v15, [email protected] and [email protected] HOT 6
- Code coverage is not instrumenting React components (React Native)
- Code rewriting breaks function name inferencing HOT 1
- nyc not working with project type module (esm) HOT 1
- nyc ignores files ending with `-test.ts`
- Unable to get coverage for files executed via runInThisContext HOT 1
- Markdown reporter HOT 1
- Is there a way to filter files in the stage `nyc report` ?
- Merging with nyc storybook test coverage with other reports generated by coverageProvider 'istanbul' result in wrong coverage HOT 2
- Issue with Instrumentation of Code Coverage for my Angular V17 Project
- is it possible to store nyc output with relative path?
- cccccbgvrekrbvdtukvnhiffetjntbbuuijkfblietjr
- Use of deprecated glob and rimraf dependencies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nyc.