Skip to content

fix(appium): Inject symlinks for all installed extensions#21664

Merged
mykola-mokhnach merged 4 commits intoappium:masterfrom
mykola-mokhnach:symlinks
Oct 20, 2025
Merged

fix(appium): Inject symlinks for all installed extensions#21664
mykola-mokhnach merged 4 commits intoappium:masterfrom
mykola-mokhnach:symlinks

Conversation

@mykola-mokhnach
Copy link
Collaborator

// We also inject the symlink into other installed extensions' node_modules folders
// as these might be cleaned up unexpectedly by npm
// (see https://github.com/appium/python-client/pull/1177#issuecomment-3419826643).
await B.all(symlinkInjectionPromises);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can probably use the native Promise.all instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

both do the same thing. Changed to Promise

Copy link
Member

@KazuCocoa KazuCocoa left a comment

Choose a reason for hiding this comment

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

This worked for update command such as appium driver update xcuitest. Then, non-symlink modules got proper appium's ones. Once I copied the same thing in the removed await injectAppiumSymlink.bind(this)(path.join(installPath, 'node_modules')); place as my comment, it helped keep the behavior for the install as well

Comment on lines 457 to 459
// After the extension is installed, we try to inject the appium module symlink
// into the extension's node_modules folder if it is not there yet.
await injectAppiumSymlink.bind(this)(path.join(installPath, 'node_modules'));
Copy link
Member

Choose a reason for hiding this comment

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

      const symlinkInjectionPromises = _.uniq([
        ...Object.values(this.config.installedExtensions).map(({installPath}) => installPath),
        installPath,
      ]).map((installPath) => injectAppiumSymlink.bind(this)(path.join(installPath, 'node_modules')));
      await B.all(symlinkInjectionPromises);

Copy link
Member

Choose a reason for hiding this comment

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

e.g.

The ======== log was a log I have added before symlinkInjectionPromises to tell these changes passed explicitly.

kazu $ appium driver install xcuitest
✔ Checking if 'appium-xcuitest-driver' is compatible
✔ Installing 'xcuitest'
⚠ [debug] ======== log
ℹ Driver xcuitest@10.2.2 successfully installed
- automationName: XCUITest
- platformNames: ["iOS","tvOS"]
kazu $ ls -all ~/.appium/node_modules/appium-xcuitest-driver/node_modules | grep 'appium'
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 @appium
lrwxr-xr-x@   1 kazu  staff     63 Oct 19 23:44 appium -> /Users/kazu/.nvm/versions/node/v22.18.0/lib/node_modules/appium
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 appium-idb
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 appium-ios-device
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 appium-ios-remotexpc
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 appium-ios-simulator
drwxr-xr-x@  11 kazu  staff    352 Oct 19 23:44 appium-ios-tuntap
drwxr-xr-x@  11 kazu  staff    352 Oct 19 23:44 appium-remote-debugger
drwxr-xr-x@  16 kazu  staff    512 Oct 19 23:44 appium-webdriveragent
drwxr-xr-x@   8 kazu  staff    256 Oct 19 23:44 appium-xcode
kazu $ appium driver install uiautomator2
✔ Checking if 'appium-uiautomator2-driver' is compatible
✔ Installing 'uiautomator2'
⚠ [debug] ======== log
ℹ Driver uiautomator2@5.0.5 successfully installed
- automationName: UiAutomator2
- platformNames: ["Android"]
kazu $ ls -all ~/.appium/node_modules/appium-xcuitest-driver/node_modules | grep 'appium'
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 @appium
lrwxr-xr-x@   1 kazu  staff     63 Oct 19 23:47 appium -> /Users/kazu/.nvm/versions/node/v22.18.0/lib/node_modules/appium
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 appium-idb
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 appium-ios-device
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 appium-ios-remotexpc
drwxr-xr-x@   9 kazu  staff    288 Oct 19 23:44 appium-ios-simulator
drwxr-xr-x@  11 kazu  staff    352 Oct 19 23:44 appium-ios-tuntap
drwxr-xr-x@  11 kazu  staff    352 Oct 19 23:44 appium-remote-debugger
drwxr-xr-x@  16 kazu  staff    512 Oct 19 23:44 appium-webdriveragent
drwxr-xr-x@   8 kazu  staff    256 Oct 19 23:44 appium-xcode

Current PR change (without my comment) worked this behavior for update

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍

Moved it back to installViaNpm

@mykola-mokhnach mykola-mokhnach merged commit 8f5aac3 into appium:master Oct 20, 2025
11 of 12 checks passed
@mykola-mokhnach mykola-mokhnach deleted the symlinks branch October 20, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

appium core Bug a problem that needs fixing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants