Skip to content
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

fix(node): instantiating process class without new #23865

Merged
merged 2 commits into from
May 17, 2024
Merged

Conversation

marvinhagemeister
Copy link
Contributor

Popular test runners like Jest instantiate a new Process object themselves and expect the class constructor to be callable without the new keyword. This PR refactors our Process class implementation from a proper ES2015 class to an ES5-style class which can be invoked both with and without the new keyword like in Node.

Fixes #23863

@marvinhagemeister marvinhagemeister merged commit 75efc74 into main May 17, 2024
17 checks passed
@marvinhagemeister marvinhagemeister deleted the process-es5 branch May 17, 2024 14:24
bartlomieju pushed a commit that referenced this pull request May 21, 2024
Popular test runners like Jest instantiate a new `Process` object
themselves and expect the class constructor to be callable without the
`new` keyword. This PR refactors our `Process` class implementation from
a proper ES2015 class to an ES5-style class which can be invoked both
with and without the `new` keyword like in Node.

Fixes #23863
bartlomieju pushed a commit that referenced this pull request May 21, 2024
Popular test runners like Jest instantiate a new `Process` object
themselves and expect the class constructor to be callable without the
`new` keyword. This PR refactors our `Process` class implementation from
a proper ES2015 class to an ES5-style class which can be invoked both
with and without the `new` keyword like in Node.

Fixes #23863
@reeceorbuck
Copy link

Sorry if this is an improper place to report this, but I believe something to do with this commit has broken an npm import for me.
import { ClientSecretCredential } from "npm:@azure/identity";

Now fails on launch due to process.versions being undefined.

The code in the module:
const process = tslib_1.__importStar(require("node:process")); const versions = process.versions; // undefined

@marvinhagemeister
Copy link
Contributor Author

marvinhagemeister commented May 31, 2024

@reeceorbuck can you open an issue for that? Otherwise I'll forget about it on Monday, because it's difficult to keep track of comments on merged PRs here on GitHub. I just saw this comment by accident as I usually tend to clear anything that's marked as done or closed in my notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: jest errors with Class constructor Process cannot be invoked without 'new'
3 participants