-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[core-util] Create isNodeLike and isNodeRuntime #29086
Conversation
API change check APIView has identified API level changes in this PR and created following API reviews. |
sdk/core/core-util/test/public/browser/checkEnvironment.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be able to port this to ts-http-runtime before you merge?
Co-authored-by: Deyaaeldeen Almahallawi <[email protected]>
@timovv done |
it("should return true", async function () { | ||
assert.isFalse(isNode); | ||
}); | ||
}); | ||
|
||
describe("isNodeRuntime (browser)", function () { | ||
it("should return true", async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test names not accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
### Packages impacted by this PR - `@azure/core-rest-pipeline` - `@typespec/ts-http-runtime` ### Describe the problem that is addressed by this PR Use `isNodeLike` in favor of the deprecated `isNode` in Core packages that depend on `core-util`. ### Provide a list of related PRs _(if any)_ - #29086
Packages impacted by this PR
Issues associated with this PR
Describe the problem that is addressed by this PR
Reverts the behavior of
isNode
checks to ensure that it can still return true for Bun and Deno. IntroducingisNodeLike
to also have the same behavior asisNode
so we can deprecate the former function. We have also addedisNodeRuntime
which then checks for an explicit Node.js runtime.What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
The previous attempt was to create a
isNodeLike
and be opt-in, versus this PR which gives the old behavior and new opt-in for strict Node runtimes.Are there test cases added in this PR? (If not, why?)
Provide a list of related PRs (if any)
Command used to generate this PR:**(Applicable only to SDK release request PRs)
Checklists