Skip to content

Commit f143ca0

Browse files
committed
Remove --debug-brk option
See #1376
1 parent f47ce41 commit f143ca0

File tree

8 files changed

+37
-52
lines changed

8 files changed

+37
-52
lines changed

docs/man_pages/project/testing/debug-android.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ debug android
33

44
Usage | Synopsis
55
---|---
6-
Deploy on device, run the app and stop at the first breakpoint | `$ tns debug android --debug-brk [--device <Device ID>] [--debug-port <port>] [--timeout <timeout>]`
7-
Deploy in the native emulator, run the app and stop at the first breakpoint | `$ tns debug android --debug-brk --emulator [<Emulator Options>] [--timeout <timeout>]`
8-
Deploy in Genymotion, run the app and stop at the first breakpoint | `$ tns debug android --debug-brk --geny <Geny Name> [--timeout <timeout>]`
6+
Deploy on device, run the app and stop at the first breakpoint | `$ tns debug android [--device <Device ID>] [--debug-port <port>] [--timeout <timeout>]`
7+
Deploy in the native emulator, run the app and stop at the first breakpoint | `$ tns debug android --emulator [<Emulator Options>] [--timeout <timeout>]`
8+
Deploy in Genymotion, run the app and stop at the first breakpoint | `$ tns debug android --geny <Geny Name> [--timeout <timeout>]`
99
Attach the debug tools to a running app on device | `$ tns debug android --start [--device <Device ID>] [--debug-port <port>] [--timeout <timeout>]`
1010
Attach the debug tools to a running app in the native emulator | `$ tns debug android --start --emulator [<Emulator Options>] [--timeout <timeout>]`
1111
Attach the debug tools to a running app in Genymotion | `$ tns debug android --start --geny <Geny Name> [--print-app-output] [--timeout <timeout>]`
@@ -18,19 +18,18 @@ Debugs your project on a connected device, in a native emulator or in Genymotion
1818
* `--device` - Specifies a connected device on which to debug the app.
1919
* `--emulator` - Specifies that you want to debug the app in the native Android emulator from the Android SDK.
2020
* `--geny` - Specifies a Genymotion emulator on which you want to debug your app.
21-
* `--debug-brk` - Prepares, builds and deploys the application package on a device or in an emulator, launches the Chrome DevTools of your Chrome browser.
2221
* `--start` - Attaches the debug tools to a deployed and running app.
2322
* `--stop` - Detaches the debug tools.
2423
* `--get-port` - Retrieves the port on which you are debugging your application.
2524
* `--debug-port` - Sets a new port on which to attach the debug tools.
2625
* `--timeout` - Sets the number of seconds that the NativeScript CLI will wait for the debugger to boot. If not set, the default timeout is 90 seconds.
2726

2827
### Attributes
29-
* `<Device ID>` is the index or name of the target device as listed by `$ tns device`
28+
* `<Device ID>` is the index or name of the target device as listed by `$ tns device`
3029
* `<Port>` is an accessible port on the device to which you want to attach the debugging tools.
3130
* `<Emulator Options>` is any valid combination of options as listed by `$ tns help emulate android`
3231
* `<GenyName>` is the name of the Genymotion virtual device that you want to use as listed by `$ genyshell -c "devices list"`
33-
32+
3433
<% if(isHtml) { %>
3534
###Prerequisites
3635

@@ -56,6 +55,6 @@ Command | Description
5655
[run ios](run-ios.html) | Runs your project on a connected iOS device or in the iOS Simulator, if configured.
5756
[run](run.html) | Runs your project on a connected device or in the native emulator for the selected platform.
5857
[test init](test-init.html) | Configures your project for unit testing with a selected framework.
59-
[test android](test-android.html) | Runs the tests in your project on Android devices or native emulators.
58+
[test android](test-android.html) | Runs the tests in your project on Android devices or native emulators.
6059
[test ios](test-ios.html) | Runs the tests in your project on iOS devices or the iOS Simulator.
6160
<% } %>

docs/man_pages/project/testing/debug-ios.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ debug ios
33

44
Usage | Synopsis
55
---|---
6-
Deploy on device, run the app and stop at the first breakpoint | `$ tns debug ios --debug-brk [--device <Device ID>] [--no-client]`
7-
Deploy in the iOS Simulator, run the app and stop at the first breakpoint | `$ tns debug ios --debug-brk --emulator [<Emulator Options>] [--no-client]`
6+
Deploy on device, run the app and stop at the first breakpoint | `$ tns debug ios [--device <Device ID>] [--no-client]`
7+
Deploy in the iOS Simulator, run the app and stop at the first breakpoint | `$ tns debug ios --emulator [<Emulator Options>] [--no-client]`
88
Attach the debug tools to a running app on device | `$ tns debug ios --start [--device <Device ID>] [--no-client]`
99
Attach the debug tools to a running app in the iOS Simulator | `$ tns debug ios --start --emulator [<Emulator Options>] [--no-client]`
1010

11-
Debugs your project on a connected device or in the iOS Simulator. <% if(isHtml) { %>Any debugging traffic is forwarded on port 8080 from the device to the local machine.<% } %>
11+
Debugs your project on a connected device or in the iOS Simulator. <% if(isHtml) { %>Any debugging traffic is forwarded on port 8080 from the device to the local machine.<% } %>
1212

13-
<% if(isConsole && (isWindows || isLinux)) { %>WARNING: You can run this command only on OS X systems. To view the complete help for this command, run `$ tns help debug ios`<% } %>
13+
<% if(isConsole && (isWindows || isLinux)) { %>WARNING: You can run this command only on OS X systems. To view the complete help for this command, run `$ tns help debug ios`<% } %>
1414

1515
<% if((isConsole && isMacOS) || isHtml) { %>
1616
<% if(isHtml) { %>> <% } %>IMPORTANT: Before building for iOS device, verify that you have configured a valid pair of certificate and provisioning profile on your OS X system. <% if(isHtml) { %>For more information, see [Obtaining Signing Identities and Downloading Provisioning Profiles](https://developer.apple.com/library/mac/recipes/xcode_help-accounts_preferences/articles/obtain_certificates_and_provisioning_profiles.html).<% } %>
1717

1818
### Options
19-
* `--debug-brk` - Prepares, builds and deploys the application package on a device or in an emulator, runs the app, launches the developer tools of your Safari browser and stops at the first breakpoint.
2019
* `--start` - Attaches the debug tools to a deployed and running app and launches the developer tools of your Safari browser.
2120
* `--emulator` - Indicates that you want to debug your app in the iOS simulator.
2221
* `--no-client` - If set, the NativeScript CLI attaches the debug tools but does not launch the developer tools in Safari.
@@ -25,8 +24,8 @@ Debugs your project on a connected device or in the iOS Simulator. <% if(isHtml)
2524
### Attributes
2625
* `<Device ID>` is the index or name of the target device as listed by `$ tns device`
2726
* `<Emulator Options>` is any valid combination of options as listed by `$ tns help emulate ios`
28-
<% } %>
29-
<% if(isHtml) { %>
27+
<% } %>
28+
<% if(isHtml) { %>
3029
### Prerequisite
3130

3231
* If you want to debug in the iOS Simulator, you must have Xcode 6 or later installed on your system.
@@ -55,6 +54,6 @@ Command | Description
5554
[run ios](run-ios.html) | Runs your project on a connected iOS device or in the iOS Simulator, if configured.
5655
[run](run.html) | Runs your project on a connected device or in the native emulator for the selected platform.
5756
[test init](test-init.html) | Configures your project for unit testing with a selected framework.
58-
[test android](test-android.html) | Runs the tests in your project on Android devices or native emulators.
57+
[test android](test-android.html) | Runs the tests in your project on Android devices or native emulators.
5958
[test ios](test-ios.html) | Runs the tests in your project on iOS devices or the iOS Simulator.
6059
<% } %>

docs/man_pages/project/testing/dev-test-android.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ test android
33

44
Usage | Synopsis
55
------|-------
6-
Run tests on all connected devices | `$ tns test android [--watch] [--debug-brk]`
7-
Run tests on a selected device | `$ tns test android --device <Device ID> [--watch] [--debug-brk]`
6+
Run tests on all connected devices | `$ tns test android [--watch]`
7+
Run tests on a selected device | `$ tns test android --device <Device ID> [--watch]`
88

99
Runs the tests in your project on connected Android devices and running native emulators.<% if(isConsole) { %> Your project must already be configured for unit testing by running `$ tns test init`.<% } %>
1010

1111
### Options
1212
* `--watch` - If set, when you save changes to the project, changes are automatically synchronized to the connected device and tests are re-run.
1313
* `--device` - Specifies the serial number or the index of the connected device on which to run the tests. To list all connected devices, grouped by platform, run `$ tns device`
14-
* `--debug-brk` - Runs the tests under the debugger. The debugger will break just before your tests are executed, so you have a chance to place breakpoints.
1514

1615
### Attributes
1716
* `<Device ID>` is the device index or identifier as listed by `$ tns device`

docs/man_pages/project/testing/test-android.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ test android
33

44
Usage | Synopsis
55
------|-------
6-
Run tests on all connected devices | `$ tns test android [--watch] [--debug-brk]`
7-
Run tests on a selected device | `$ tns test android --device <Device ID> [--watch] [--debug-brk]`
6+
Run tests on all connected devices | `$ tns test android [--watch]`
7+
Run tests on a selected device | `$ tns test android --device <Device ID> [--watch]`
88

99
Runs the tests in your project on connected Android devices and running native emulators.<% if(isConsole) { %> Your project must already be configured for unit testing by running `$ tns test init`.<% } %>
1010

1111
### Options
1212
* `--watch` - If set, when you save changes to the project, changes are automatically synchronized to the connected device and tests are re-run.
1313
* `--device` - Specifies the serial number or the index of the connected device on which to run the tests. To list all connected devices, grouped by platform, run `$ tns device`
14-
* `--debug-brk` - Runs the tests under the debugger. The debugger will break just before your tests are executed, so you have a chance to place breakpoints.
1514

1615
### Attributes
1716
* `<Device ID>` is the device index or identifier as listed by `$ tns device`

docs/man_pages/project/testing/test-ios.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ test ios
33

44
Usage | Synopsis
55
------|-------
6-
Run tests on all connected devices | `$ tns test ios [--watch] [--debug-brk]`
7-
Run tests on a selected device | `$ tns test ios --device <Device ID> [--watch] [--debug-brk]`
8-
Run tests in the iOS Simulator | `$ tns test ios --emulator [--watch] [--debug-brk]`
6+
Run tests on all connected devices | `$ tns test ios [--watch]`
7+
Run tests on a selected device | `$ tns test ios --device <Device ID> [--watch]`
8+
Run tests in the iOS Simulator | `$ tns test ios --emulator [--watch]`
99

1010
Runs the tests in your project on connected iOS devices or the iOS Simulator.<% if(isConsole && isMacOS) { %> Your project must already be configured for unit testing by running `$ tns test init`.<% } %>
1111

12-
<% if(isConsole && (isLinux || isWindows)) { %>WARNING: You can run this command only on OS X systems. To view the complete help for this command, run `$ tns help test ios`<% } %>
12+
<% if(isConsole && (isLinux || isWindows)) { %>WARNING: You can run this command only on OS X systems. To view the complete help for this command, run `$ tns help test ios`<% } %>
1313

1414
<% if((isConsole && isMacOS) || isHtml) { %>
1515
### Options
1616
* `--watch` - If set, when you save changes to the project, changes are automatically synchronized to the connected device and tests are re-ran.
1717
* `--device` - Specifies the serial number or the index of the connected device on which you want to run tests. To list all connected devices, grouped by platform, run `$ tns device`. You cannot set `--device` and `--emulator` simultaneously.
1818
* `--emulator` - Runs tests on the iOS Simulator. You cannot set `--device` and `--emulator` simultaneously.
19-
* `--debug-brk` - Runs the tests under the debugger. The debugger will break just before your tests are executed, so you have a chance to place breakpoints.
2019

2120
### Attributes
2221
* `<Device ID>` is the device index or identifier as listed by `$ tns device`<% } %>

lib/services/android-debug-service.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,9 @@ class AndroidDebugService implements IDebugService {
9494
return (() => {
9595
let packageFile = "";
9696

97-
if(!this.$options.debugBrk && !this.$options.start && !this.$options.getPort && !this.$options.stop) {
98-
this.$logger.warn("Neither --debug-brk nor --start option was specified. Defaulting to --debug-brk.");
99-
this.$options.debugBrk = true;
100-
}
97+
let debugBrk = !this.$options.start && !this.$options.getPort && !this.$options.stop;
10198

102-
if (this.$options.debugBrk && !this.$options.emulator) {
99+
if (debugBrk && !this.$options.emulator) {
103100
let cachedDeviceOption = this.$options.forDevice;
104101
this.$options.forDevice = true;
105102
this.$platformService.buildPlatform(this.platform).wait();
@@ -127,7 +124,7 @@ class AndroidDebugService implements IDebugService {
127124
this.attachDebugger(device.deviceInfo.identifier, packageName).wait();
128125
} else if (this.$options.stop) {
129126
this.detachDebugger(packageName).wait();
130-
} else if (this.$options.debugBrk) {
127+
} else {
131128
this.startAppWithDebugger(packageFile, packageName).wait();
132129
}
133130
}).future<void>()();

lib/services/ios-debug-service.ts

+6-15
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,17 @@ class IOSDebugService implements IDebugService {
3737
}
3838

3939
public debug(): IFuture<void> {
40-
if (this.$options.debugBrk && this.$options.start) {
41-
this.$errors.failWithoutHelp("Expected exactly one of the --debug-brk or --start options.");
42-
}
43-
44-
if(!this.$options.debugBrk && !this.$options.start) {
45-
this.$logger.warn("Neither --debug-brk nor --start option was specified. Defaulting to --debug-brk.");
46-
this.$options.debugBrk = true;
47-
}
48-
4940
if (this.$options.emulator) {
50-
if (this.$options.debugBrk) {
51-
return this.emulatorDebugBrk();
52-
} else if (this.$options.start) {
41+
if (this.$options.start) {
5342
return this.emulatorStart();
43+
} else {
44+
return this.emulatorDebugBrk();
5445
}
5546
} else {
56-
if (this.$options.debugBrk) {
57-
return this.deviceDebugBrk();
58-
} else if (this.$options.start) {
47+
if (this.$options.start) {
5948
return this.deviceStart();
49+
} else {
50+
return this.deviceDebugBrk();
6051
}
6152
}
6253

lib/services/test-execution-service.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class TestExecutionService implements ITestExecutionService {
3737
private $errors: IErrors) {
3838
}
3939

40+
private debugBrk: boolean;
41+
4042
public startTestRunner(platform: string) : IFuture<void> {
4143
return (() => {
4244
this.$options.justlaunch = true;
@@ -50,7 +52,7 @@ class TestExecutionService implements ITestExecutionService {
5052
let projectFilesPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME);
5153

5254
let configOptions: IKarmaConfigOptions = JSON.parse(launcherConfig);
53-
this.$options.debugBrk = configOptions.debugBrk;
55+
this.debugBrk = configOptions.debugBrk;
5456
this.$options.debugTransport = configOptions.debugTransport;
5557
let configJs = this.generateConfig(configOptions);
5658
this.$fs.writeFile(path.join(projectDir, TestExecutionService.CONFIG_FILE_NAME), configJs).wait();
@@ -119,13 +121,13 @@ class TestExecutionService implements ITestExecutionService {
119121
getApplicationPathForiOSSimulatorAction: getApplicationPathForiOSSimulatorAction,
120122
localProjectRootPath: localProjectRootPath,
121123
beforeBatchLiveSyncAction: beforeBatchLiveSyncAction,
122-
shouldRestartApplication: (localToDevicePaths: Mobile.ILocalToDevicePathData[]) => Future.fromResult(!this.$options.debugBrk),
124+
shouldRestartApplication: (localToDevicePaths: Mobile.ILocalToDevicePathData[]) => Future.fromResult(!this.debugBrk),
123125
canExecuteFastLiveSync: (filePath: string) => false,
124126
};
125127

126128
this.$usbLiveSyncServiceBase.sync(liveSyncData).wait();
127129

128-
if (this.$options.debugBrk) {
130+
if (this.debugBrk) {
129131
this.$logger.info('Starting debugger...');
130132
let debugService: IDebugService = this.$injector.resolve(`${platform}DebugService`);
131133
debugService.debugStart().wait();
@@ -163,7 +165,7 @@ class TestExecutionService implements ITestExecutionService {
163165
node: process.execPath,
164166
options: {
165167
debugTransport: this.$options.debugTransport,
166-
debugBrk: this.$options.debugBrk,
168+
debugBrk: this.debugBrk,
167169
}
168170
},
169171
};
@@ -173,7 +175,7 @@ class TestExecutionService implements ITestExecutionService {
173175
if (!this.$options.watch) {
174176
karmaConfig.singleRun = true;
175177
}
176-
if (this.$options.debugBrk) {
178+
if (this.debugBrk) {
177179
karmaConfig.browserNoActivityTimeout = 1000000000;
178180
}
179181
this.$logger.debug(JSON.stringify(karmaConfig, null, 4));

0 commit comments

Comments
 (0)