-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: ADB.pidof(deviceId, bundleId) does not work consistently across…
… Android versions (#839) * Resolves #831 * feat: makes launch() implementation for Android stricter - it fails if PID is not found
- Loading branch information
Showing
5 changed files
with
54 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const SPECIAL_CHARS = /([\^\$\[\]\*\.\\])/g; | ||
|
||
function regexEscape(exactString) { | ||
return exactString.replace(SPECIAL_CHARS, "\\$1"); | ||
} | ||
|
||
module.exports = regexEscape; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const regexEscape = require('./regexEscape'); | ||
|
||
describe(regexEscape.name, () => { | ||
it('should not escape non-special characters', () => { | ||
const nonspecial = 'bundle_name'; | ||
expect(regexEscape(nonspecial)).toBe(nonspecial); | ||
}); | ||
|
||
it('should escape [\\]', () => { | ||
const bundleId = '[kworker\\0:0]'; | ||
expect(regexEscape(bundleId)).toBe('\\[kworker\\\\0:0\\]'); | ||
}); | ||
|
||
it('should escape ^*$', () => { | ||
const bundleId = '^ma*tch$'; | ||
expect(regexEscape(bundleId)).toBe('\\^ma\\*tch\\$'); | ||
}); | ||
|
||
it('should escape dots', () => { | ||
const bundleId = 'com.company.bundle'; | ||
expect(regexEscape(bundleId)).toBe('com\\.company\\.bundle'); | ||
}); | ||
}); |