-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node 20: process.chdir can break via typescript-eslint v7 (works in Node 18) #53730
Comments
HIi! Thanks for the report. Currently, your report includes several different files and dependencies. It would easier for members of the community to reproduce if you shorten your example to be minimally reproducible. When you get a chance, please edit your issue to include a reproducible example (preferably with few files, and no dependencies) |
I will do so as soon as I can isolate this. I just discovered a key detail. In Node 18, |
Weird! They should (IIRC) be the exact same, for example: async function main() {
const assert = require('assert');
const cjsProcess = require('node:process');
const mjsProcess = await import('node:process');
for (const [nKey, nValue] of Object.entries(process)) {
const cValue = cjsProcess[nKey];
const mValue = mjsProcess[nKey];
assert.strictEqual(cValue, nValue);
assert.strictEqual(mValue, nValue);
assert.strictEqual(cValue, mValue);
}
}
main(); |
Continuing to get weirder. I was able to trigger this craziness with just an import statement: import {
Extractor,
ExtractorConfig,
ExtractorResult
} from '@microsoft/api-extractor'; Yes, I know that API Extractor isn't part of my testcase. That's not the point. The point is Figuring out what statement inside my imported libraries caused that is going to take a while. Thus, so will reducing this testcase further. |
This bug is invalid. Deep in the dependency chain is graceful-fs, which has a lovely replacement of process.cwd(). I'm really sorry for all the noise. |
But wait a minute, why did Node 18 let that go and Node 20 didn't? |
If your issue is with a dependency, it's hard to tell what could cause the issue. If you find the root cause, and you're able to reproduce without any dependencies, please open a new issue :-). |
Version
v20.15.0
Platform
Subsystem
process
What steps will reproduce the bug?
package.json
tsconfig.json
build.js (this is where the bug manifests)
utilities/stage-build.js
utilities/toBeLinted.ts
utilities/typescript-eslintrc.cjs
(I'm sorry. I tried to make this as minimal a testcase as I could.)
This completes cleanly:
pop to /home/ajvincent/test/nodejs-cwd-regression
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
What do you see instead?
Additional information
Standard eslint version 8 (which typescript-eslint v7 is tied to) linting against JavaScript files doesn't seem to trigger this.
I also suspected this might be related to #53681, another "Node 18 versus Node 20" bug I had filed a few days ago, but testing with some debugging loader hooks I have show that is incorrect. Unfortunately, because of that same bug, I cannot step through in the Chrome Developer Tools to give more information.
The text was updated successfully, but these errors were encountered: