mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 12:29:07 +00:00
This consolidates duplicate functions that were scattered across the codebase: 1. **Platform detection functions** (isWindows, isLinux, isMacOS, isPosix) - Created internal/platform.ts module for built-in JS modules - Updated test files to import from harness instead of redefining 2. **Patch test snapshot normalization** - Created harness-patch.ts for shared normalizeBunSnapshotForPatch - Consolidated identical implementations from 2 test files 3. **Removed inline isLinux redefinition** - net.ts was defining isLinux twice, now uses shared import Files affected: - src/js/internal/platform.ts (new shared module) - src/js/internal/fs/glob.ts (use shared isWindows) - src/js/node/net.ts (use shared isWindows and isLinux) - test/harness-patch.ts (new shared test utility) - test/cli/install/bun-install-patch.test.ts - test/regression/issue/patch-bounds-check.test.ts - test/js/node/test/common/index.js - test/napi/node-napi-tests/test/common/index.js 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
These files are copied from https://github.com/190n/node/tree/napi-tests-bun, which in turn is a fork of Node.js with their js-native-api tests modified slightly to work in Bun.
To change these files, edit the Node.js fork and then copy the changed version here.
We should periodically (and definitely when we add new Node-API functions) sync that fork with Node.js upstream.