js-sdk
js-sdk copied to clipboard
refactor: check if node via process.versions
Description
This removes the process.title check for node and uses process.versions instead, process.title
is not really reliable as it can be set by code, for example some CLIs will rename the process, by using process.versions.node we can be more sure that we're in node, unless we're in a runtime that stubs this.
Looking at the libuv codebase we can see that the uv_get_process_title function has an assertion that the title retrieved is not empty, given that we've only seen this on Windows it's possible there's some permissions issue or similar that is causing this.
References
Closes #219
Review Checklist
- [x] I have clicked on "allow edits by maintainers".
- [ ] I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
- [x] The correct base branch is being used, if not
main - [ ] I have added tests to validate that the change in functionality is working as expected
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 88.18%. Comparing base (
05c790e) to head (c70cb28).
Additional details and impacted files
@@ Coverage Diff @@
## main #222 +/- ##
==========================================
+ Coverage 88.01% 88.18% +0.16%
==========================================
Files 23 23
Lines 1202 1202
Branches 211 192 -19
==========================================
+ Hits 1058 1060 +2
+ Misses 85 84 -1
+ Partials 59 58 -1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Nice investigation!