ryanluker / vscode-coverage-gutters

Display test coverage generated by lcov and xml - works with many languages
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
MIT License
460 stars 88 forks source link

broken devcontainer experience: npm ci fails #383

Closed trenttobler closed 1 year ago

trenttobler commented 1 year ago

Describe the bug

fschwaiger/cobertura-parse npm package link uses git/ssh. It looks like this causes issues in negotiating the ssh key when installing npm packages from within the container. I suspect there may be a way to configure this, but wondering if migrating to use https resolution instead works.

Steps To Reproduce

  1. git clone this repository
  2. launch vscode with microsoft remote extensions enabled
  3. open the source repository folder in devcontainer
  4. Notice error (same as below)
  5. type rm -rf node_modules
  6. try to install npm dependencies: npm i
  7. Error:
    
    npm ERR! Error while executing:
    npm ERR! /usr/local/bin/git ls-remote -h -t ssh://git@github.com/fschwaiger/cobertura-parse.git
    npm ERR! 
    npm ERR! git@github.com: Permission denied (publickey).
    npm ERR! fatal: Could not read from remote repository.
    npm ERR! 
    npm ERR! Please make sure you have the correct access rights
    npm ERR! and the repository exists.
    npm ERR! 
    npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in: npm ERR! /home/node/.npm/_logs/2022-11-05T20_04_42_604Z-debug.log



**Work Arounds**

Option A (from devcontainer);
1. run the command `npm add cobertura-parse@https://github.com/fschwaiger/cobertura-parse#82b0333cb1580f6f337b5d44b04e2f5ca8711b7e`
2. run the command `npm ci`
3. profit.

Option B (from container host):
1. install node and npm
2. setup ssh key with github
3. run `npm ci` on a command line
4. relaunch vscode devcontainer experience.
5. profit.

**Expected behaviour**

I like that you've added the devcontainer experience.  I have been advocating this same "development tooling as code" approach myself.

I  think it would be expected that one can manage npm dependencies from within the container.  This can be challenging for the non-npm public repository references - some orgs may have restrictions on git https vs. ssh that can limit be limiting,

**Desktop (please complete the following information):**
 - OS: windows 10 + WSL2 Ubuntu 20.04.4 LTS
 - Extension Version: N/A - github source repo
 - VSCode Version: 1.73.0 

**Additional context**

Its unfortunate that the published cobertura-parse npm package is old and required a fork to fix.  More ideal would be to be able to reference it directly instead of indirectly from github.

My original goal when I started exploring the code was to see if I could [integrate the Koverage extension](https://github.com/ryanluker/vscode-coverage-gutters/issues/151) and, further, to enhance it with both line and branch coverage percentages.
ryanluker commented 1 year ago

@trenttobler Thanks for submitting a ticket! Good to see you found a workaround but it is definitely annoying and the dev containers should work out of the box (I use the codespaces one personally for small stuff all the time).

I made a branch here and tested in codespaces and locally via docker desktop. It seemed to be working properly with the new node 16 and github specific flow for adding a npm package. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#github-urls https://github.com/ryanluker/vscode-coverage-gutters/pull/384

Edit

Opps nope, it still resolves to using git + ssh if you look at the npm list afterwords. It is odd that it still worked though locally for me 🤔. cobertura-parse@1.0.6 (git+ssh://git@github.com/fschwaiger/cobertura-parse.git#82b0333cb1580f6f337b5d44b04e2f5ca8711b7e)

ryanluker commented 1 year ago

@trenttobler this was merged into the master branch and should be good for you to use now.