-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Exported adb utilities to be used in third party nodejs scripts (…
- Loading branch information
1 parent
dd6596d
commit 856a125
Showing
12 changed files
with
136 additions
and
22 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,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 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 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 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