feat: Ditch bluebird and lodash#1130
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the bluebird and lodash dependencies by migrating affected code to native Promises, standard library helpers, and small in-repo utility functions, while also modernizing URL handling in WebDriverAgent.
Changes:
- Replaced
bluebirdusage (delay,all,filter,Promisector) with native Promise patterns. - Removed
lodashhelpers by using native equivalents and adding small utilities (escapeRegExp,truncateString, object merge). - Migrated
WebDriverAgentURL parsing from legacyurl.parseto WHATWGURL, updating impacted tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/webdriveragent-specs.ts | Updates unit tests to remove lodash usage and align assertions with WHATWG URL (pathname). |
| test/functional/helpers/simulator.ts | Replaces lodash flattening with Object.values(...).flat(). |
| package.json | Drops bluebird, lodash, and related @types/* packages from dependencies. |
| lib/xcodebuild.ts | Removes bluebird/lodash usage; switches to native Promise patterns and new utils helpers. |
| lib/webdriveragent.ts | Removes bluebird/lodash; migrates URL handling to WHATWG URL and adds toUrl compatibility fallback. |
| lib/utils.ts | Removes bluebird/lodash; adds small helpers and replaces lodash merge/filtering logic. |
| lib/check-dependencies.ts | Refactors function placement and adds doc comment (no behavioral dependency changes). |
| Scripts/fetch-prebuilt-wda.mjs | Removes bluebird/lodash; switches to native Promise aggregation and top-level await flow. |
| Scripts/build-webdriveragent.mjs | Uses try/catch with top-level await instead of .catch() chaining. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.proxyReqRes = this.jwproxy.proxyReqRes.bind(this.jwproxy); | ||
|
|
||
| this.noSessionProxy = new NoSessionProxy(proxyOpts); | ||
| return (await Promise.all(existsPromises)).some((v) => v === false); |
There was a problem hiding this comment.
isSourceFresh() currently returns true when any of the required resource paths is missing (it uses some(v === false)), which is the opposite of what the method name and JSDoc claim ("true if source is fresh / all required files exist"). This can lead to callers treating an incomplete checkout as "fresh". Consider inverting the logic (e.g., return true only if all fs.exists results are true) or update the documentation/name to match the intended semantics.
| return (await Promise.all(existsPromises)).some((v) => v === false); | |
| return (await Promise.all(existsPromises)).every((v) => v === true); |
| private toUrl(value: string): URL { | ||
| try { | ||
| return new URL(value); | ||
| } catch (err) { | ||
| // Keep compatibility with legacy parser behavior for values like "localhost:8100". | ||
| if (!value.includes(URL_PROTOCOL_SEPARATOR)) { | ||
| return new URL(`http://${value}`); | ||
| } | ||
| throw err; | ||
| } | ||
| } |
There was a problem hiding this comment.
toUrl() adds a compatibility fallback for legacy values like "localhost:8100" when URL parsing fails. This is a behavior-critical path (it affects how webDriverAgentUrl/wdaBaseUrl are interpreted) but it doesn't appear to be covered by the existing unit tests. Adding a focused test case for a scheme-less URL (and possibly other edge cases you intend to support) would help prevent regressions.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
## [12.2.0](v12.1.1...v12.2.0) (2026-04-29) ### Features * Ditch bluebird and lodash ([#1130](#1130)) ([8899895](8899895))
|
🎉 This PR is included in version 12.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
No description provided.