Skip to content

Android artifacts missing when the test name contains a dollar amount #4798

@ieatfood

Description

@ieatfood

Did you test using the latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test fail and you're not sure why?

  • I have read the troubleshooting guide and it didn't help me.

What happened?

The test.mp4 and device.log artifacts fail to get moved from the device to the artifact directory when the test name contains text that the shell interprets as a variable, such as $100 or $TOKEN. Interestingly, screenshots taken during the test do work.

Issue lies in the adb.pull() method using double quotes for the destination path, which allows for shell expansion of the test summary.

What was the expected behaviour?

No response

Help us reproduce this issue!

Simple test with $1 in the name:

describe('Android Artifacts', () => {
  beforeEach(async () => {
    await device.reloadReactNative();
  });

  it('should save artifacts when test contains a dollar amount in name: $1', async () => {
    await expect(element(by.text('Sanity'))).toBeVisible();
  });
});
Output:

$ npm exec detox test -- --configuration android.emu.release 38.android-artifacts.test.js                                                                                                                                                                                                                                  1 ↵
21:07:30.627 detox[56806] B jest --config e2e/jest.config.js 38.android-artifacts.test.js
21:07:30.940 detox[56807] i watchman warning: Recrawled this watch 3 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/me/repos/Detox' ; watchman watch-project '/Users/me/repos/Detox'`

21:07:33.082 detox[56807] i 38.android-artifacts.test.js is assigned to emulator-5554 (Pixel_3a_API_34)
21:07:33.709 detox[56807] i Android Artifacts: should save artifacts when test contains a dollar amount in name: $1
21:07:34.508 detox[56807] i Android Artifacts: should save artifacts when test contains a dollar amount in name: $1 [OK]

21:07:35.565 detox[56807] i ""/Users/me/Library/Android/sdk/platform-tools/adb" -s emulator-5554 pull "/sdcard/21731456_1.log" "artifacts/android.emu.release.2025-07-10 04-07-30Z/✓ Android Artifacts should save artifacts when test contains a dollar amount in name_ $1/device.log"" failed with error = Error: Command failed: "/Users/me/Library/Android/sdk/platform-tools/adb" -s emulator-5554 pull "/sdcard/21731456_1.log" "artifacts/android.emu.release.2025-07-10 04-07-30Z/✓ Android Artifacts should save artifacts when test contains a dollar amount in name_ $1/device.log"
adb: error: cannot create file/directory 'artifacts/android.emu.release.2025-07-10 04-07-30Z/✓ Android Artifacts should save artifacts when test contains a dollar amount in name_ /device.log': No such file or directory
 (code=1), stdout and stderr:

21:07:35.566 detox[56807] i
21:07:35.566 detox[56807] i adb: error: cannot create file/directory 'artifacts/android.emu.release.2025-07-10 04-07-30Z/✓ Android Artifacts should save artifacts when test contains a dollar amount in name_ /device.log': No such file or directory

21:07:35.566 detox[56807] i Suppressed error inside function call.
  error: Command failed: "/Users/me/Library/Android/sdk/platform-tools/adb" -s emulator-5554 pull "/sdcard/21731456_1.log" "artifacts/android.emu.release.2025-07-10 04-07-30Z/✓ Android Artifacts should save artifacts when test contains a dollar amount in name_ $1/device.log"
  adb: error: cannot create file/directory 'artifacts/android.emu.release.2025-07-10 04-07-30Z/✓ Android Artifacts should save artifacts when test contains a dollar amount in name_ /device.log': No such file or directory

 PASS  e2e/38.android-artifacts.test.js
  Android Artifacts
    ✓ should save artifacts when test contains a dollar amount in name: $1 (457 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        4.594 s
Ran all test suites matching 38.android-artifacts.test.js.

In what environment did this happen?

Detox version: 20.40.1
React Native version:
Has Fabric (React Native's new rendering system) enabled: (yes/no)
Node version:
Device model:
Android version:
Test-runner (select one): jest

Detox logs

No response

Device logs

No response

More data, please!

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions