Skip to content

feat: Ditch bluebird and lodash#1130

Merged
mykola-mokhnach merged 5 commits intomasterfrom
deps-upd
Apr 29, 2026
Merged

feat: Ditch bluebird and lodash#1130
mykola-mokhnach merged 5 commits intomasterfrom
deps-upd

Conversation

@mykola-mokhnach
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 bluebird usage (delay, all, filter, Promise ctor) with native Promise patterns.
  • Removed lodash helpers by using native equivalents and adding small utilities (escapeRegExp, truncateString, object merge).
  • Migrated WebDriverAgent URL parsing from legacy url.parse to WHATWG URL, 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.

Comment thread lib/webdriveragent.ts Outdated
this.proxyReqRes = this.jwproxy.proxyReqRes.bind(this.jwproxy);

this.noSessionProxy = new NoSessionProxy(proxyOpts);
return (await Promise.all(existsPromises)).some((v) => v === false);
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
return (await Promise.all(existsPromises)).some((v) => v === false);
return (await Promise.all(existsPromises)).every((v) => v === true);

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed

Comment thread lib/webdriveragent.ts
Comment on lines +529 to +539
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;
}
}
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@mykola-mokhnach mykola-mokhnach merged commit 8899895 into master Apr 29, 2026
50 of 51 checks passed
@mykola-mokhnach mykola-mokhnach deleted the deps-upd branch April 29, 2026 06:36
github-actions Bot pushed a commit that referenced this pull request Apr 29, 2026
## [12.2.0](v12.1.1...v12.2.0) (2026-04-29)

### Features

* Ditch bluebird and lodash ([#1130](#1130)) ([8899895](8899895))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 12.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants