Skip to content

WorkspaceFolder Uri.fsPath drive letter normalization to lowercase on Windows causing extension issues #68325

Closed
@enlyth

Description

@enlyth

I'll give an example where this behaviour creates issues, which I think is fairly common, e.g. spawning Jest by running a command like npm test via process.spawn, like the vscode-jest extension does, while using a transformer like babel-jest.

The extension gets its path via vscode.workspace, and WorkspaceFolder.Uri.fsPath is normalized to a lower-case drive letter.

The following code demonstrates this issue:

const childProcess = require("child_process");

// Uppercase drive letter, tests will run fine
const cwd = "C:\\src2\\myproj";

// Lowercase drive letter, this will FAIL, unable to resolve modules when running
// const cwd = "c:\\src2\\myproj"; 

const proc = childProcess.spawn(
  "npm",
  [
    "test",
    "--",
    "--json",
    "--useStderr",
    "--outputFile",
    "C:\\Users\\BORIS~1.POP\\AppData\\Local\\Temp/jest_runner.json",
    "--watch",
  ],
  { cwd: cwd, shell: true, env: process.env }
);

fsPath returning an uppercase drive letter on Windows seems to have been already suggested here:
#42159 (comment)

  • VSCode Version: 1.32.0-insider
  • OS Version: Windows 10 Build 17134

Steps to Reproduce:

  1. Set up any project which uses babel-jest, and Jest
  2. Run code above from command line

Does this issue occur when all extensions are disabled?: Irrelevant

Metadata

Metadata

Assignees

Labels

*as-designedDescribed behavior is as designeduri

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions