Closed
Description
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:
- Set up any project which uses babel-jest, and Jest
- Run code above from command line
Does this issue occur when all extensions are disabled?: Irrelevant