Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 950702e

Browse files
authored
Fix path errors on windows (#1770)
1 parent 157faa1 commit 950702e

File tree

4 files changed

+73
-64
lines changed

4 files changed

+73
-64
lines changed

code-push-plugin-testing-framework/script/platform.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,22 +243,15 @@ var AndroidEmulatorManager = (function () {
243243
*/
244244
AndroidEmulatorManager.prototype.prepareEmulatorForTest = function (appId) {
245245
return this.endRunningApplication(appId)
246-
.then(function () { return testUtil_1.TestUtil.getProcessOutput("adb shell pm clear " + appId); }).then(function () { return null; });
246+
.then(function () {
247+
return commandWithCheckAppExistence("adb shell pm clear", appId);
248+
});
247249
};
248250
/**
249251
* Uninstalls the app from the emulator.
250252
*/
251253
AndroidEmulatorManager.prototype.uninstallApplication = function (appId) {
252-
return testUtil_1.TestUtil.getProcessOutput("adb shell pm list packages")
253-
.then(function (output) {
254-
return output.includes(appId);
255-
}).then(function (isAppExist) {
256-
if (isAppExist) {
257-
return testUtil_1.TestUtil.getProcessOutput("adb uninstall " + appId).then(function () { return null; });
258-
}
259-
260-
return null;
261-
});
254+
return commandWithCheckAppExistence("adb uninstall", appId);
262255
};
263256
AndroidEmulatorManager.ANDROID_EMULATOR_OPTION_NAME = "--androidemu";
264257
AndroidEmulatorManager.DEFAULT_ANDROID_EMULATOR = "emulator";
@@ -398,3 +391,16 @@ var IOSEmulatorManager = (function () {
398391
return IOSEmulatorManager;
399392
}());
400393
exports.IOSEmulatorManager = IOSEmulatorManager;
394+
395+
function commandWithCheckAppExistence(command, appId) {
396+
return testUtil_1.TestUtil.getProcessOutput("adb shell pm list packages", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true })
397+
.then((output) => {
398+
return output.includes(appId);
399+
}).then((isAppExist) => {
400+
if (isAppExist) {
401+
return testUtil_1.TestUtil.getProcessOutput(`${command} ${appId}`).then(function () { return null; });
402+
}
403+
console.log(`Command "${command}" is skipped because the application has not yet been installed`)
404+
return null;
405+
});
406+
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
"xcode": "1.0.0"
4545
},
4646
"devDependencies": {
47-
"@types/mocha": "^5.2.7",
48-
"@types/node": "^13.1.8",
4947
"@types/assert": "^1.4.3",
5048
"@types/mkdirp": "^0.5.2",
49+
"@types/mocha": "^5.2.7",
50+
"@types/node": "^13.1.8",
5151
"@types/q": "^1.5.2",
5252
"archiver": "latest",
5353
"body-parser": "latest",
@@ -56,9 +56,10 @@
5656
"express": "latest",
5757
"mkdirp": "latest",
5858
"mocha": "^7.0.0",
59-
"shx": "^0.3.2",
6059
"q": "^1.5.1",
6160
"run-sequence": "latest",
61+
"shx": "^0.3.2",
62+
"slash": "^3.0.0",
6263
"tslint": "^5.20.1",
6364
"typescript": "^3.7.5"
6465
},

0 commit comments

Comments
 (0)