Skip to content

Commit 5c938e5

Browse files
Fix unresolved futures
There are some unresolved futures in android debug service which leads to `Error: There are outstanding futures. Construction call stacks:` errors. Fix them and fix unit tests on Windows.
1 parent b7492af commit 5c938e5

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

lib/services/android-debug-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class AndroidDebugService implements IDebugService {
8484
} else if (this.$options.stop) {
8585
this.detachDebugger(packageName).wait();
8686
} else if (this.$options.debugBrk) {
87-
this.startAppWithDebugger(packageFile, packageName);
87+
this.startAppWithDebugger(packageFile, packageName).wait();
8888
} else {
8989
this.$logger.info("Should specify at least one option: debug-brk, start, stop, get-port.");
9090
}
@@ -115,7 +115,7 @@ class AndroidDebugService implements IDebugService {
115115
}
116116
}
117117
if ((0 < port) && (port < 65536)) {
118-
this.tcpForward(port, port);
118+
this.tcpForward(port, port).wait();
119119
this.startDebuggerClient(port).wait();
120120
this.openDebuggerClient(AndroidDebugService.DEFAULT_NODE_INSPECTOR_URL + "?port=" + port);
121121
} else {
@@ -147,7 +147,7 @@ class AndroidDebugService implements IDebugService {
147147

148148
let dbgPort = this.startAndGetPort(packageName).wait();
149149
if (dbgPort > 0) {
150-
this.tcpForward(dbgPort, dbgPort);
150+
this.tcpForward(dbgPort, dbgPort).wait();
151151
this.startDebuggerClient(dbgPort).wait();
152152
this.openDebuggerClient(AndroidDebugService.DEFAULT_NODE_INSPECTOR_URL + "?port=" + dbgPort);
153153
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"main": "./lib/nativescript-cli.js",
1212
"scripts": {
13-
"test": "node_modules\\.bin\\_mocha --ui mocha-fibers --recursive --reporter spec --require test/test-bootstrap.js --timeout 30000 test/",
13+
"test": "node_modules\\.bin\\_mocha --ui mocha-fibers --recursive --reporter spec --require test/test-bootstrap.js --timeout 60000 test/",
1414
"postinstall": "node postinstall.js",
1515
"preuninstall": "node preuninstall.js"
1616
},

test/android-project-properties-manager.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe("Android project properties parser tests", () => {
4646
let projectPropertiesManager = testInjector.resolve(ProjectPropertiesManagerLib.AndroidProjectPropertiesManager, {directoryPath: tempFolder});
4747
projectPropertiesManager.addProjectReference("testValue").wait();
4848

49-
let expectedContent = 'target=android-21' + os.EOL +
49+
let expectedContent = 'target=android-21' + '\n' +
5050
'android.library.reference.1=testValue';
5151
let actualContent = fs.readText(path.join(tempFolder, "project.properties")).wait();
5252

@@ -57,17 +57,17 @@ describe("Android project properties parser tests", () => {
5757
let testInjector = createTestInjector();
5858
let fs = testInjector.resolve("fs");
5959

60-
let projectPropertiesFileContent = 'target=android-21' + os.EOL +
60+
let projectPropertiesFileContent = 'target=android-21' + '\n' +
6161
'android.library.reference.1=someValue';
6262
let tempFolder = temp.mkdirSync("AndroidProjectPropertiesManager");
6363
fs.writeFile(path.join(tempFolder, "project.properties"), projectPropertiesFileContent).wait();
6464

6565
let projectPropertiesManager = testInjector.resolve(ProjectPropertiesManagerLib.AndroidProjectPropertiesManager, {directoryPath: tempFolder});
6666
projectPropertiesManager.addProjectReference("testValue").wait();
6767

68-
let expectedContent = 'target=android-21' + os.EOL +
69-
'android.library.reference.1=someValue' + os.EOL +
70-
'android.library.reference.2=testValue';
68+
let expectedContent = ['target=android-21',
69+
'android.library.reference.1=someValue',
70+
'android.library.reference.2=testValue'].join('\n');
7171
let actualContent = fs.readText(path.join(tempFolder, "project.properties")).wait();
7272

7373
assert.equal(expectedContent, actualContent);
@@ -77,19 +77,19 @@ describe("Android project properties parser tests", () => {
7777
let testInjector = createTestInjector();
7878
let fs = testInjector.resolve("fs");
7979

80-
let projectPropertiesFileContent = 'target=android-21' + os.EOL +
81-
'android.library.reference.1=value1' + os.EOL +
82-
'android.library.reference.2=value2' + os.EOL +
83-
'android.library.reference.3=value3' + os.EOL +
84-
'android.library.reference.4=value4' + os.EOL +
85-
'android.library.reference.5=value5';
80+
let projectPropertiesFileContent = ['target=android-21',
81+
'android.library.reference.1=value1',
82+
'android.library.reference.2=value2',
83+
'android.library.reference.3=value3',
84+
'android.library.reference.4=value4',
85+
'android.library.reference.5=value5'].join('\n');
8686
let tempFolder = temp.mkdirSync("AndroidProjectPropertiesManager");
8787
fs.writeFile(path.join(tempFolder, "project.properties"), projectPropertiesFileContent).wait();
8888

8989
let projectPropertiesManager: IAndroidProjectPropertiesManager = testInjector.resolve(ProjectPropertiesManagerLib.AndroidProjectPropertiesManager, {directoryPath: tempFolder});
9090
projectPropertiesManager.addProjectReference("testValue").wait();
9191

92-
let expectedContent = projectPropertiesFileContent + os.EOL +
92+
let expectedContent = projectPropertiesFileContent + '\n' +
9393
'android.library.reference.6=testValue';
9494

9595
let actualContent = fs.readText(path.join(tempFolder, "project.properties")).wait();
@@ -101,7 +101,7 @@ describe("Android project properties parser tests", () => {
101101
let testInjector = createTestInjector();
102102
let fs = testInjector.resolve("fs");
103103

104-
let projectPropertiesFileContent = 'android.library.reference.1=value1' + os.EOL +
104+
let projectPropertiesFileContent = 'android.library.reference.1=value1' + '\n' +
105105
'target=android-21';
106106
let tempFolder = temp.mkdirSync("AndroidProjectPropertiesManager");
107107
fs.writeFile(path.join(tempFolder, "project.properties"), projectPropertiesFileContent).wait();
@@ -119,23 +119,23 @@ describe("Android project properties parser tests", () => {
119119
let testInjector = createTestInjector();
120120
let fs = testInjector.resolve("fs");
121121

122-
let projectPropertiesFileContent = 'target=android-17' + os.EOL +
123-
'android.library.reference.1=value1' + os.EOL +
124-
'android.library.reference.2=value2' + os.EOL +
125-
'android.library.reference.3=value3' + os.EOL +
126-
'android.library.reference.4=value4' + os.EOL +
127-
'android.library.reference.5=value5';
122+
let projectPropertiesFileContent = ['target=android-17',
123+
'android.library.reference.1=value1',
124+
'android.library.reference.2=value2',
125+
'android.library.reference.3=value3',
126+
'android.library.reference.4=value4',
127+
'android.library.reference.5=value5'].join('\n');
128128
let tempFolder = temp.mkdirSync("AndroidProjectPropertiesManager");
129129
fs.writeFile(path.join(tempFolder, "project.properties"), projectPropertiesFileContent).wait();
130130

131131
let projectPropertiesManager: IAndroidProjectPropertiesManager = testInjector.resolve(ProjectPropertiesManagerLib.AndroidProjectPropertiesManager, {directoryPath: tempFolder});
132132
projectPropertiesManager.removeProjectReference("value3").wait();
133133

134-
let expectedContent = 'target=android-17' + os.EOL +
135-
'android.library.reference.1=value1' + os.EOL +
136-
'android.library.reference.2=value2' + os.EOL +
137-
'android.library.reference.3=value4' + os.EOL +
138-
'android.library.reference.4=value5' + os.EOL;
134+
let expectedContent = ['target=android-17',
135+
'android.library.reference.1=value1',
136+
'android.library.reference.2=value2',
137+
'android.library.reference.3=value4',
138+
'android.library.reference.4=value5'].join('\n') + '\n';
139139
let actualContent = fs.readText(path.join(tempFolder, "project.properties")).wait();
140140

141141
assert.equal(expectedContent, actualContent);

0 commit comments

Comments
 (0)