-
Notifications
You must be signed in to change notification settings - Fork 359
feat: export the adb utilities to be used in third party nodejs scripts #2116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
525fd59
initial attempt to export adb utils
ankushduacodes b94db98
revert accidental changes to imports
ankushduacodes d11cf88
revert accidental changes to imports
ankushduacodes 712d5c6
add deviceId param
ankushduacodes 914847f
add deviceId param
ankushduacodes 744f97d
added lazy loading to adb function imports
ankushduacodes 72f31a3
added type annotation to getter
ankushduacodes 2d8e5a9
added tests to test out new adb util export
ankushduacodes d3f799e
refactored test-import and test-require to reduce code duplication
ankushduacodes 1f061a1
fixed paths for newly refactored import tests
ankushduacodes e612848
fixed test-require imports
ankushduacodes ea76ae3
trying to fix webext-as-library imports
ankushduacodes 3354d88
trying to fix webext-as-library exports
ankushduacodes 20a52cd
trying to fix webext-as-library exports
ankushduacodes 90cf955
trying to fix webext-as-library exports
ankushduacodes a00f2ae
trying to fix webext-as-library exports
ankushduacodes 5e4760b
trying to fix webext-as-library exports
ankushduacodes 2c3f3da
trying to fix webext-as-library exports
ankushduacodes 8c659db
trying to fix webext-as-library exports
ankushduacodes 116d49f
more trying to fix webext-as-library exports
ankushduacodes 2ea9470
addressing minor changes
ankushduacodes 610e85e
testing
ankushduacodes 40c626f
testing windows inports/exports
ankushduacodes 56bb049
trying to distingush between win32 path and posix path
ankushduacodes cc3f3e9
removing log statemet
ankushduacodes 49f1e71
testing new exposed adb functions
ankushduacodes bad409f
added some documentation for new ADB functions and on how to run an e…
ankushduacodes 5ebea01
updated adbPathString to use path lib
ankushduacodes 9616682
docs update
ankushduacodes c74a4e2
Addressing minor nits
ankushduacodes 24c4483
Update README.md
ankushduacodes 22edc26
Update README.md
ankushduacodes 4794f81
wording change
ankushduacodes 3c3bd4a
more wording change
ankushduacodes 315c0f7
addressing final few nits and polish requests
ankushduacodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,32 @@ | ||
const assert = require('assert'); | ||
const path = require('path'); | ||
|
||
function testModuleExports(webExt) { | ||
assert.deepEqual(Object.keys(webExt).sort(), ['cmd', 'main', 'util'].sort()); | ||
assert.deepEqual(Object.keys(webExt.util).sort(), ['logger', 'adb'].sort()); | ||
assert.equal(typeof webExt.cmd.run, 'function'); | ||
|
||
assertImportedADB({expectLoaded: false}); | ||
assert.deepEqual( | ||
Object.keys(webExt.util.adb).sort(), | ||
['listADBDevices', 'listADBFirefoxAPKs'].sort(), | ||
); | ||
assertImportedADB({expectLoaded: true}); | ||
} | ||
|
||
function assertImportedADB({expectLoaded}) { | ||
const adbPathString = path.join('@devicefarmer', 'adbkit'); | ||
const hasAdbDeps = Object.keys(require.cache).filter( | ||
(filePath) => filePath.includes(adbPathString) | ||
).length > 0; | ||
|
||
const msg = expectLoaded | ||
? 'adb module should have been loaded' | ||
: 'adb module should not be loaded yet'; | ||
|
||
assert.equal(hasAdbDeps, expectLoaded, msg); | ||
} | ||
|
||
module.exports = { | ||
testModuleExports, | ||
}; |
This file contains hidden or 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,9 @@ | ||
// eslint-disable-next-line import/no-unresolved | ||
import webExt from 'web-ext'; | ||
|
||
// eslint-disable-next-line import/extensions | ||
import helpers from './helpers.js'; | ||
|
||
const {testModuleExports} = helpers; | ||
|
||
testModuleExports(webExt); |
This file contains hidden or 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,5 @@ | ||
const webExt = require('web-ext'); | ||
|
||
const {testModuleExports} = require('./helpers.js'); | ||
|
||
testModuleExports(webExt); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.