microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.35k stars 28.6k forks source link

${relativeFile} single backslash on windows #144251

Closed rikbrowning closed 2 years ago

rikbrowning commented 2 years ago

Does this issue occur when all extensions are disabled?: Yes'

Version: 1.64.2 (user setup) Commit: f80445acd5a3dadef24aa209168452a3d97cc326 Date: 2022-02-09T22:02:28.252Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19041

Steps to Reproduce:

  1. Run a task that uses ${relativeFile} and it is outputting single black slash as the file path. launch.json
    
    {
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    {
      "type": "pwa-node",
      "request": "launch",
      "name": "Debug Current Test File",
      "autoAttachChildProcesses": true,
      "skipFiles": ["<node_internals>/**", "**/node_modules/**"],
      "program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
      "args": ["run", "${relativeFile}"],
      "smartStep": true,
      "console": "integratedTerminal"
    }
    ]
    }
 output
```bash
PS C:\Git\feather-design-system>  ${env:NODE_OPTIONS}='--require "c:/Users/rbrowning/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" --inspect-publish-uid=http'; ${env:VSCODE_INSPECTOR_OPTIONS}='{"inspectorIpc":"\\\\.\\pipe\\node-cdp.21404-3.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\\Program Files\\nodejs\\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\\Users\\RBROWN~1\\AppData\\Local\\Temp\\node-debug-callback-e648716b75d95106"}'; & 'C:\Program Files\nodejs\node.exe' '.\node_modules\vitest\vitest.mjs' 'run' 'packages\@featherds\autocomplete\src\components\FeatherAutocomplete.spec.js'
Debugger attached.

 RUN  v0.5.9 C:/Git/feather-design-system

No test files found

Waiting for the debugger to disconnect...

If I change the string manually to forward slash it runs as expected

${env:NODE_OPTIONS}='--require "c:/Users/rbrowning/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" --inspect-publish-uid=http'; ${env:VSCODE_INSPECTOR_OPTIONS}='{"inspectorIpc":"\\\\.\\pipe\\node-cdp.21404-3.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\\Program Files\\nodejs\\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\\Users\\RBROWN~1\\AppData\\Local\\Temp\\node-debug-callback-e648716b75d95106"}'; & 'C:\Program Files\nodejs\node.exe' '.\node_modules\vitest\vitest.mjs' 'run' 'packages/@featherds/autocomplete/src/components/FeatherAutocomplete.spec.js'     

 RUN  v0.5.9 C:/Git/feather-design-system

 ❯ packages/@featherds/autocomplete/src/components/FeatherAutocomplete.spec.js (76)
   ❯ FeatherAutocomplete (76)
     ↓ base functionality (46) 

Not sure if this is related to #40256

weinand commented 2 years ago

@rikbrowning I've verified for Windows that all path related variables return backward slashes. So this is not a specific problem of ${relativeFile}. It looks like your test runner doesn't like backslashes...

But when reading my comment in #40256 I get the impression that all variables should use forward slashes on all platforms.

@alexr00 do you know why this was changed?

alexr00 commented 2 years ago

My understanding is that we try to always use platform specific slashes and that relativeFiles was updated several years ago to be consistent: https://github.com/microsoft/vscode/issues/70050#issuecomment-472052839