You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clone vscode-python-environments on a machine where any @types packages exist in an enclosing parent directory (such as in ~/.node_modules/@types or C:\Users\<username>\node_modules\@types).
Navigate to the api package:
cd api
Run the API package validation test script:
npm run test:package
Expected behavior
The package test runner (api/scripts/test-package.cjs) creates temporary consumer fixture projects (modern and legacy) in os.tmpdir() and verifies type checking against @vscode/python-environments in complete isolation, referencing only the explicitly installed consumer types (@types/node and @types/vscode).
Actual behavior
TypeScript compilation (tsc --project <consumerRoot>/tsconfig.json) fails during fixture verification because api/test/tsconfig.modern.json and api/test/tsconfig.legacy.json omit types and typeRoots.
Under TypeScript's default type discovery, tsc searches for ambient node_modules/@types folders up the directory hierarchy from the temporary folder through the user home directory. Any broken, partially installed, or incompatible global type definition packages (such as an empty or malformed @types/d3-scale) are implicitly loaded and cause the test suite to abort.
Additionally:
api/scripts/test-package.cjs assumes typescript is installed at api/node_modules/typescript/bin/tsc, which throws MODULE_NOT_FOUND when dependencies are resolved from the repository root.
api/package.json lacks a "test" script, causing standard npm test invocations to fail with npm error Missing script: "test".
Logs
error TS2688: Cannot find type definition file for 'd3-scale'.
The file is in the program because:
Entry point for implicit type library 'd3-scale'
node:child_process:922
throw err;
^
Error: Command failed: C:\Program Files\nodejs\node.exe D:\vscode-python-environments\api\node_modules\typescript\bin\tsc --project C:\Users\Satyam\AppData\Local\Temp\python-environments-api-I2BCwo\modern\tsconfig.json
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at checkExecSyncError (node:child_process:883:11)
at execFileSync (node:child_process:919:15)
at runNodeScript (D:\vscode-python-environments\api\scripts\test-package.cjs:20:12)
at Object.<anonymous> (D:\vscode-python-environments\api\scripts\test-package.cjs:77:9)
at Module._compile (node:internal/modules/cjs/loader:1730:14)
at Object..js (node:internal/modules/cjs/loader:1895:10)
at Module.load (node:internal/modules/cjs/loader:1465:32)
at Function._load (node:internal/modules/cjs/loader:1282:12) {
status: 2,
signal: null,
output: [ null, null, null ],
pid: 19372,
stdout: null,
stderr: null
}
Node.js v22.17.0
Additional context
Resolution
Isolate Consumer tsconfigs: In both api/test/tsconfig.modern.json and api/test/tsconfig.legacy.json, specify:
Environment data
1.37.0(@vscode/python-environments@1.4.0)ms-python.python) version: N/A (Build / Packaging validation)1.99.0+@types)build: share API declarations across module formats)Repro Steps
vscode-python-environmentson a machine where any@typespackages exist in an enclosing parent directory (such as in~/.node_modules/@typesorC:\Users\<username>\node_modules\@types).apipackage:cd apiExpected behavior
The package test runner (
api/scripts/test-package.cjs) creates temporary consumer fixture projects (modernandlegacy) inos.tmpdir()and verifies type checking against@vscode/python-environmentsin complete isolation, referencing only the explicitly installed consumer types (@types/nodeand@types/vscode).Actual behavior
TypeScript compilation (
tsc --project <consumerRoot>/tsconfig.json) fails during fixture verification becauseapi/test/tsconfig.modern.jsonandapi/test/tsconfig.legacy.jsonomittypesandtypeRoots.Under TypeScript's default type discovery,
tscsearches for ambientnode_modules/@typesfolders up the directory hierarchy from the temporary folder through the user home directory. Any broken, partially installed, or incompatible global type definition packages (such as an empty or malformed@types/d3-scale) are implicitly loaded and cause the test suite to abort.Additionally:
api/scripts/test-package.cjsassumestypescriptis installed atapi/node_modules/typescript/bin/tsc, which throwsMODULE_NOT_FOUNDwhen dependencies are resolved from the repository root.api/package.jsonlacks a"test"script, causing standardnpm testinvocations to fail withnpm error Missing script: "test".Logs
Additional context
Resolution
tsconfigs: In bothapi/test/tsconfig.modern.jsonandapi/test/tsconfig.legacy.json, specify:@types/*packages on the host system.tscResolution: Inapi/scripts/test-package.cjs, resolvetypescript/bin/tscvia:api/node_modulesor rootnode_modules."test": "npm run test:package"inapi/package.json.