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

Add ability to interpet WSL file paths #49

Closed CherryDT closed 7 years ago

CherryDT commented 7 years ago

I'm using VSCode under Windows, but the actual code runs under Linux, hence the tests etc. also run under Linux (via WSL).

Unfortunately this means that the paths in lcov.info are like /mnt/c/Users/david/proj/myProject/myFile.js and your extension says "no coverage for file" for every file because it probably looks for C:\Users\david\proj\myProject\myFile.js instead.

Would it be possible to automatically convert the path (if it starts with /mnt) so that it can find the file?

ryanluker commented 7 years ago

@CherryDT hmm the option to use relativeSF paths may fix your issue. if you set coverage-gutters.altSfCompare to true, in your settings, and restart your vscode does that help any? I specifically use this option myself as I use WSL as well on my windows machine 😄 .

CherryDT commented 7 years ago

Hm, I just tried that but I got the same error.

Does the lcov.info file location have any effect on that? It is coverage/lcov.info for me.

ryanluker commented 7 years ago

hmm that file location looks fine to me... did you set the flag and restart vscode? sometimes the settings dont pickup til next IDE open. Worst case I will tinker on my machine to try to get the same error and get back to you sometime over the weekend.

CherryDT commented 7 years ago

Yes I did. Thanks for checking it for me! 👍

ryanluker commented 7 years ago

Hey @CherryDT I tinkered locally myself and couldn't replicate your same issue, except when I set altSfCompare to false then I would get the error...

Running coverage and starting vscode through bash on windows:

Writing coverage object [/mnt/c/dev/vscode-coverage-gutters/example/coverage/coverage.json]
Writing coverage reports at [/mnt/c/dev/vscode-coverage-gutters/example/coverage]
=============================================================================

=============================== Coverage summary ===============================
Statements   : 92.31% ( 24/26 )
Branches     : 80% ( 8/10 )
Functions    : 100% ( 6/6 )
Lines        : 95.83% ( 23/24 )
================================================================================
ryanluker@DESKTOP-7AO6PTV:/mnt/c/dev/vscode-coverage-gutters/example$ code

Generate lcov file:

TN:
SF:/mnt/c/dev/vscode-coverage-gutters/example/test.js
FN:6,(anonymous_1)
FN:7,(anonymous_2)
FN:12,(anonymous_3)
FN:17,(anonymous_4)
FN:22,(anonymous_5)
FNF:5
FNH:5
FNDA:1,(anonymous_1)
FNDA:1,(anonymous_2)
FNDA:1,(anonymous_3)
FNDA:1,(anonymous_4)
FNDA:1,(anonymous_5)
DA:3,1
DA:4,1
DA:6,1
DA:7,1
DA:8,1
DA:9,1

Coverage displayed: testcov-0421

Settings.json file:

// Place your settings in this file to overwrite the default settings
{
    "editor.renderWhitespace": "boundary",
    "files.trimTrailingWhitespace": true,
    "coverage-gutters.altSfCompare": true,
    "coverage-gutters.customizable.menus-editor-context-displayCoverage-enabled": false,
    "coverage-gutters.customizable.menus-editor-context-watchLcovFile-enabled": false,
    "coverage-gutters.customizable.menus-editor-context-removeCoverage-enabled": false
}

I could do more debugging if you provided me with more details like your windows version (creators on windows 10?), settings.json file, lcov.info file, vscode version and extension version. You should remove anything in those files that doesn't seem dev related, if you do choose to post them here, no personal info please. Hopefully we can get this sorted out!

ryanluker commented 7 years ago

@CherryDT any more insight into this issue?

CherryDT commented 7 years ago

@ryanluker sorry I got a bit distracted there.

CU on Windows 10, yes (15063.138).

settings.json (User):

// Place your settings in this file to overwrite the default settings
{
    "git.confirmSync": false,
    "editor.renderWhitespace": "boundary",
    "editor.insertSpaces": false,
    "editor.fontFamily": "Ubuntu Mono",
    "editor.wrappingIndent": "indent",
    "editor.renderIndentGuides": true,
    "window.reopenFolders": "all",
    "files.eol": "\n",
    "explorer.openEditors.visible": 10,
    "css.lint.ieHack": "warning",
    "scss.lint.ieHack": "warning",
    "less.lint.ieHack": "warning",
    "javascript.format.insertSpaceAfterKeywordsInControlFlowStatements": false,
    "javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
    "typescript.format.insertSpaceAfterKeywordsInControlFlowStatements": false,
    "typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
    "extensions.autoUpdate": true,
    "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe",
    "terminal.integrated.shellArgs.windows": ["--login"],
    "telemetry.enableTelemetry": false,
    "ecdc.collectTelemetry": false,
    "php.validate.executablePath": "C:\\Users\\david\\WTServer\\Bin\\php.bat",
    "terminal.integrated.commandsToSkipShell": [
        "editor.action.toggleTabFocusMode",
        "workbench.action.debug.continue",
        "workbench.action.debug.restart",
        "workbench.action.debug.run",
        "workbench.action.debug.start",
        "workbench.action.debug.stop",
        "workbench.action.openNextRecentlyUsedEditorInGroup",
        "workbench.action.openPreviousRecentlyUsedEditorInGroup",
        /*"workbench.action.quickOpen",*/
        "workbench.action.showCommands",
        "workbench.action.terminal.clear",
        "workbench.action.terminal.copySelection",
        "workbench.action.terminal.focus",
        "workbench.action.terminal.focusNext",
        "workbench.action.terminal.focusPrevious",
        "workbench.action.terminal.kill",
        "workbench.action.terminal.new",
        "workbench.action.terminal.paste",
        "workbench.action.terminal.runSelectedText",
        "workbench.action.terminal.scrollDown",
        "workbench.action.terminal.scrollDownPage",
        "workbench.action.terminal.scrollToBottom",
        "workbench.action.terminal.scrollToTop",
        "workbench.action.terminal.scrollUp",
        "workbench.action.terminal.scrollUpPage",
        "workbench.action.terminal.toggleTerminal"
    ],
    "files.associations": {
        "*.tag": "htmltag"
    }
    ,
    "sync.gist": "",
    "sync.lastUpload": "",
    "sync.autoDownload": false,
    "sync.autoUpload": false,
    "sync.lastDownload": "",
    "sync.version": 262,
    "sync.showSummary": true,
    "sync.forceDownload": false,
    "window.zoomLevel": 0,
    "sync.anonymousGist": false,
    "editor.wordWrap": "on",
    "sync.host": "",
    "sync.pathPrefix": "",
    "editor.snippetSuggestions": "top",
    "standard.enable": false
}

settings.json (Workspace):

// Place your settings in this file to overwrite default and user settings.
{
    "standard.enable": true,
    "javascript.validate.enable": false,
    "jshint.enable": false,
    "search.exclude": {
        "logs": true,
        "*.log": true,
        "npm-debug.log*": true,
        "pids": true,
        "*.pid": true,
        "*.seed": true,
        "coverage": true,
        ".nyc_output": true,
        ".lock-wscript": true,
        "node_modules": true,
        ".npm": true,
        ".node_repl_history": true
    },
    "files.exclude": {
        ".nyc_output": true,
        ".npm": true,
        ".node_repl_history": true
  },
  "coverage-gutters.lcovname": "lcov.info",
  "coverage-gutters.altSfCompare": true
}

lcov.info (excerpt) - path is C:\Users\david\proj\something\coverage\lcov.info (I have already tried changing the lcovname to coverage/lcov.info to no avail)

TN:
SF:/mnt/c/Users/david/proj/something/app/app.js
FN:5,createApp
FN:12,(anonymous_1)
FNF:2
FNH:1
FNDA:1,createApp
FNDA:0,(anonymous_1)
DA:1,1
DA:2,1
DA:3,1
DA:6,1
DA:7,1
DA:9,1
DA:10,1
DA:12,1
DA:14,1
DA:16,1
DA:19,1
LF:11
LH:11
BRF:0
BRH:0
end_of_record
TN:
SF:/mnt/c/Users/david/proj/something/app/config.js
FN:6,(anonymous_0)
FN:7,(anonymous_1)
FN:12,(anonymous_2)
FN:41,(anonymous_3)
FNF:4
FNH:1
FNDA:0,(anonymous_0)
FNDA:2,(anonymous_1)
FNDA:0,(anonymous_2)
FNDA:0,(anonymous_3)
DA:1,2
DA:2,2
DA:4,2
DA:6,0
DA:7,2
DA:10,2
DA:12,0
DA:15,2
DA:41,0
DA:156,2
DA:158,2
LF:11
LH:8
BRDA:7,0,0,0
BRDA:7,0,1,2
BRDA:12,1,0,0
BRDA:12,1,1,0
BRDA:156,2,0,0
BRDA:156,2,1,2
BRDA:156,3,0,2
BRDA:156,3,1,0
BRF:8
BRH:3
end_of_record
[... more here ...]

VSCode version: 1.12.0-insider, commit 48ae6e30... Extension version: 0.5.0

ryanluker commented 7 years ago

@CherryDT Thanks for the extra info, sadly I do not have any progress on getting the extension to fail for me locally... The last thing we can try (and the most time consuming for you) is to have you checkout this project and run the extension in development mode with vscode (debug -> launch extension) and open the project you are trying to apply coverage for. This way you can add a few breakpoints like the ones in the screenshot below and we can really dig into why you are getting that message (of note are the config store values for altSFCompare and the array file paths). Let me know if you attempt this and get anything interesting or need assistance with the debugging. cherry-issue170430

CherryDT commented 7 years ago

Hello, I didn't have time to debug it yet. Now I wanted to take a look at it again, but now it suddenly appears to work just fine! Not sure what was changed.

ryanluker commented 7 years ago

Good to hear that the extension is working! by chance did you update to 0.6.0? I did tinker with the coverage bits alittle in this last release... Anyways I will close this ticket in a couple days unless something comes up.