Open loidy opened 1 year ago
I am having the same problem. Did you find a workaround?
Essentially, I have 2 yarn workspaces and I need to point nyc one folder level up: "cwd" : "../"
. However, this causes nyc not to find any files at all.
@sw-tracker Here is fix: https://github.com/istanbuljs/nyc/pull/1484 And I'm using my fixed fork when installing with npm: https://github.com/loidy/nyc
How can I use your version? I cant find it in npmjs...
@sw-tracker npm install --save-dev git+https://github.com/loidy/nyc.git
Link to bug demonstration repository
https://github.com/loidy/nyccwd - or any other initial angular project
Steps to reproduce
npm install
npm run dev
orng build --configuration development
nyc instrument --complete-copy --delete --source-map=true --cwd dist/nyccwd . instrumented
Expected Behavior
When
--cwd
option is used, I expect that input is relative to provided--cwd
path.Observed Behavior
Input is still relative to current directory regardless of
--cwd
option. However, cwd is still used when considering if file should be instrumented. In combination with--complete-copy
it results in complete copy of the input (relative to current directory, not cwd) directory without instrumenting any file.Troubleshooting steps
-
Environment Information
Proposed Solution
https://github.com/istanbuljs/nyc/pull/1484
Additional Information
I needed to instrument code with relative paths to --cwd directory, because I have to run it on different system. For this I provided relative path to
transform
function instead of absolute. Without correct --cwd behavior I was not able to run command from project root directory and still access original source files to remap sources.