Skip to content

Commit

Permalink
fix: improve browser detection when running with Bun (#1319)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipriancaba authored Nov 15, 2023
1 parent bf4b8f2 commit 6097ff7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/twelve-kids-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/openapi-core": patch
---

Fixed incorrect browser detection by removing check for 'self' as Bun also exposes it by default.
2 changes: 1 addition & 1 deletion packages/core/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const isBrowser =
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
typeof window !== 'undefined' || typeof self !== 'undefined' || typeof process === 'undefined'; // main and worker thread
typeof window !== 'undefined' || typeof process === 'undefined'; // main and worker thread
export const env = isBrowser ? {} : process.env || {};

1 comment on commit 6097ff7

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.12% 4057/5330
🟡 Branches 65.94% 2151/3262
🟡 Functions 68.3% 657/962
🟡 Lines 76.31% 3805/4986

Test suite run success

646 tests passing in 93 suites.

Report generated by 🧪jest coverage report action from 6097ff7

Please sign in to comment.