Skip to content

Commit d3ee2ba

Browse files
author
Yash Ladha
committedJul 30, 2020
chore: lint markdown in README
1 parent 4b897c3 commit d3ee2ba

File tree

1 file changed

+73
-74
lines changed

1 file changed

+73
-74
lines changed
 

‎README.md

+73-74
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ Sample Usage:
4343
`browserstack-runner` can also be used as a module. To run your tests, inside your project do -
4444

4545
```node
46-
var browserstackRunner = require('browserstack-runner');
46+
var browserstackRunner = require("browserstack-runner");
4747

48-
var config = require('./browserstack.json');
48+
var config = require("./browserstack.json");
4949

5050
browserstackRunner.run(config, function(error, report) {
51-
if(error) {
51+
if (error) {
5252
console.log("Error:" + error);
5353
return;
5454
}
@@ -58,6 +58,7 @@ browserstackRunner.run(config, function(error, report) {
5858
```
5959

6060
The callback to `browserstackRunner.run` is called with two params -
61+
6162
- `error`: This parameter is either `null` or an `Error` object (if test execution failed) with message as the reason of why executing the tests on `BrowserStack` failed.
6263
- `report`: This is an array which can be used to keep track of the executed tests and suites in a run. Each object in the array has the following keys -
6364
- `browser`: The name of the browser the test executed on.
@@ -74,10 +75,7 @@ The structure of the `report` object is as follows -
7475
{
7576
"name": "isOdd()",
7677
"suiteName": "Odd Tests",
77-
"fullName": [
78-
"Odd Tests",
79-
"isOdd()"
80-
],
78+
"fullName": ["Odd Tests", "isOdd()"],
8179
"status": "passed",
8280
"runtime": 2,
8381
"errors": [],
@@ -108,18 +106,13 @@ The structure of the `report` object is as follows -
108106
"childSuites": [
109107
{
110108
"name": "Odd Tests",
111-
"fullName": [
112-
"Odd Tests"
113-
],
109+
"fullName": ["Odd Tests"],
114110
"childSuites": [],
115111
"tests": [
116112
{
117113
"name": "isOdd()",
118114
"suiteName": "Odd Tests",
119-
"fullName": [
120-
"Odd Tests",
121-
"isOdd()"
122-
],
115+
"fullName": ["Odd Tests", "isOdd()"],
123116
"status": "passed",
124117
"runtime": 2,
125118
"errors": [],
@@ -181,17 +174,17 @@ To run browser tests on BrowserStack infrastructure, you need to create a `brows
181174

182175
### Parameters for `browserstack.json`
183176

184-
* `username`: BrowserStack username (Or `BROWSERSTACK_USERNAME` environment variable)
185-
* `key`: BrowserStack [access key](https://www.browserstack.com/accounts/local-testing) (Or `BROWSERSTACK_KEY` environment variable)
186-
* `test_path`: Path to the test page which will run the tests when opened in a browser.
187-
* `test_framework`: Specify test framework which will run the tests. Currently supporting qunit, jasmine, jasmine1.3.1, jasmine2 and mocha.
188-
* `test_server_port`: Specify test server port that will be opened from BrowserStack. If not set the default port 8888 will be used. Find a [list of all supported ports on browerstack.com](https://www.browserstack.com/question/664).
189-
* `timeout`: Specify worker timeout with BrowserStack.
190-
* `browsers`: A list of browsers on which tests are to be run. Find a [list of all supported browsers and platforms on browerstack.com](https://www.browserstack.com/list-of-browsers-and-platforms?product=js_testing).
191-
* `build`: A string to identify your test run in Browserstack. In `TRAVIS` setup `TRAVIS_COMMIT` will be the default identifier.
192-
* `proxy`: Specify a proxy to use for the local tunnel. Object with `host`, `port`, `username` and `password` properties.
193-
* `exit_with_fail`: If set to true the cli process will exit with fail if any of the tests failed. Useful for automatic build systems.
194-
* `tunnel_pid_file`: Specify a path to file to save the tunnel process id into. Can also by specified using the `--pid` flag while launching browserstack-runner from the command line.
177+
- `username`: BrowserStack username (Or `BROWSERSTACK_USERNAME` environment variable)
178+
- `key`: BrowserStack [access key](https://www.browserstack.com/accounts/local-testing) (Or `BROWSERSTACK_KEY` environment variable)
179+
- `test_path`: Path to the test page which will run the tests when opened in a browser.
180+
- `test_framework`: Specify test framework which will run the tests. Currently supporting qunit, jasmine, jasmine1.3.1, jasmine2 and mocha.
181+
- `test_server_port`: Specify test server port that will be opened from BrowserStack. If not set the default port 8888 will be used. Find a [list of all supported ports on browerstack.com](https://www.browserstack.com/question/664).
182+
- `timeout`: Specify worker timeout with BrowserStack.
183+
- `browsers`: A list of browsers on which tests are to be run. Find a [list of all supported browsers and platforms on browerstack.com](https://www.browserstack.com/list-of-browsers-and-platforms?product=js_testing).
184+
- `build`: A string to identify your test run in Browserstack. In `TRAVIS` setup `TRAVIS_COMMIT` will be the default identifier.
185+
- `proxy`: Specify a proxy to use for the local tunnel. Object with `host`, `port`, `username` and `password` properties.
186+
- `exit_with_fail`: If set to true the cli process will exit with fail if any of the tests failed. Useful for automatic build systems.
187+
- `tunnel_pid_file`: Specify a path to file to save the tunnel process id into. Can also by specified using the `--pid` flag while launching browserstack-runner from the command line.
195188

196189
A sample configuration file:
197190

@@ -232,32 +225,35 @@ A sample configuration file:
232225
`browsers` parameter is a list of objects, where each object contains the details of the browsers on which you want to run your tests. This object differs for browsers on desktop platforms and browsers on mobile platforms. Browsers on desktop platform should contain `browser`, `browser_version`, `os`, `os_version` parameters set as required and the `cli_key` parameter is optional and can be used in the command line when tests need to be run on a set of browsers from the `browserstack.json` file.
233226

234227
Example:
228+
235229
```json
236230
{
237-
"browser": "ie",
238-
"browser_version": "10.0",
239-
"os": "Windows",
240-
"os_version": "8",
241-
"cli_key": 1
231+
"browser": "ie",
232+
"browser_version": "10.0",
233+
"os": "Windows",
234+
"os_version": "8",
235+
"cli_key": 1
242236
}
243237
```
244238

245239
For mobile platforms, `os`, `os_version` and `device` parameters are required.
246240

247241
Example:
242+
248243
```json
249-
[{
250-
"os": "ios",
251-
"os_version": "8.3",
252-
"device": "iPhone 6 Plus",
253-
"cli_key": 1
254-
},
255-
{
256-
"os": "android",
257-
"os_version": "4.0",
258-
"device": "Google Nexus",
259-
"cli_key": 2
260-
}
244+
[
245+
{
246+
"os": "ios",
247+
"os_version": "8.3",
248+
"device": "iPhone 6 Plus",
249+
"cli_key": 1
250+
},
251+
{
252+
"os": "android",
253+
"os_version": "4.0",
254+
"device": "Google Nexus",
255+
"cli_key": 2
256+
}
261257
]
262258
```
263259

@@ -266,48 +262,52 @@ For a full list of supported browsers, platforms and other details, [visit the B
266262
#### Compact `browsers` configuration
267263

268264
When `os` and `os_version` granularity is not desired, following configuration can be used:
269-
* `[browser]_current` or *browser*_latest: will assign the latest version of the *browser*.
270-
* `[browser]_previous`: will assign the previous version of the *browser*.
271-
* `[browser]_[version]`: will assign the *version* specified of the *browser*. Minor versions can be concatenated with underscores.
265+
266+
- `[browser]_current` or _browser_\_latest: will assign the latest version of the _browser_.
267+
- `[browser]_previous`: will assign the previous version of the _browser_.
268+
- `[browser]_[version]`: will assign the _version_ specified of the _browser_. Minor versions can be concatenated with underscores.
272269

273270
This can also be mixed with fine-grained configuration.
274271

275272
Example:
273+
276274
```json
277275
{
278276
"browsers": [
279-
"chrome_previous",
280-
"chrome_latest",
281-
"firefox_previous",
282-
"firefox_latest",
283-
"ie_6",
284-
"ie_11",
285-
"opera_12_1",
286-
"safari_5_1",
287-
{
288-
"browser": "ie",
289-
"browser_version": "10.0",
290-
"device": null,
291-
"os": "Windows",
292-
"os_version": "8",
293-
"cli_key": 1
294-
}
277+
"chrome_previous",
278+
"chrome_latest",
279+
"firefox_previous",
280+
"firefox_latest",
281+
"ie_6",
282+
"ie_11",
283+
"opera_12_1",
284+
"safari_5_1",
285+
{
286+
"browser": "ie",
287+
"browser_version": "10.0",
288+
"device": null,
289+
"os": "Windows",
290+
"os_version": "8",
291+
"cli_key": 1
292+
}
295293
]
296294
}
297295
```
296+
298297
**Note:**
299298
These shortcuts work only for browsers on desktop platforms supported by BrowserStack.
300299

301300
### Proxy support for BrowserStack local
302301

303302
Add the following in `browserstack.json`
303+
304304
```json
305305
{
306306
"proxy": {
307-
"host": "localhost",
308-
"port": 3128,
309-
"username": "foo",
310-
"password": "bar"
307+
"host": "localhost",
308+
"port": 3128,
309+
"username": "foo",
310+
"password": "bar"
311311
}
312312
}
313313
```
@@ -316,20 +316,18 @@ Add the following in `browserstack.json`
316316

317317
To avoid duplication of system or user specific information across several configuration files, use these environment variables:
318318

319-
* `BROWSERSTACK_USERNAME`: BrowserStack user name.
320-
* `BROWSERSTACK_KEY`: BrowserStack key.
321-
* `TUNNEL_ID`: Identifier for the current instance of the tunnel process. In `TRAVIS` setup `TRAVIS_JOB_ID` will be the default identifier.
322-
* `BROWSERSTACK_JSON`: Path to the browserstack.json file. If null, `browserstack.json` in the root directory will be used.
323-
* `BROWSERSTACK_LOCAL_BINARY_PATH`: Path to the browserstack local binary present on the system. If null, `BrowserStackLocal` in the `lib/` directory will be used.
324-
319+
- `BROWSERSTACK_USERNAME`: BrowserStack user name.
320+
- `BROWSERSTACK_KEY`: BrowserStack key.
321+
- `TUNNEL_ID`: Identifier for the current instance of the tunnel process. In `TRAVIS` setup `TRAVIS_JOB_ID` will be the default identifier.
322+
- `BROWSERSTACK_JSON`: Path to the browserstack.json file. If null, `browserstack.json` in the root directory will be used.
323+
- `BROWSERSTACK_LOCAL_BINARY_PATH`: Path to the browserstack local binary present on the system. If null, `BrowserStackLocal` in the `lib/` directory will be used.
325324

326325
### Secure Information
327326

328327
To avoid checking in the BrowserStack `username` and `key` in your source control system, the corresponding environment variables can be used.
329328

330329
These can also be provided by a build server, for example [using secure environment variables on Travis CI](http://about.travis-ci.org/docs/user/build-configuration/#Secure-environment-variables).
331330

332-
333331
### Code Sample
334332

335333
Check out code sample [here](https://github.com/browserstack/browserstack-runner-sample).
@@ -353,7 +351,8 @@ Tests are also run for every pull request, courtesy [Travis CI](https://travis-c
353351
You might face [build timeout issue on Travis](https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received) if runner takes more than 10 minutes to run tests.
354352

355353
There are 2 possible ways to solve this problem:
356-
1. Run a script which does `console.log` every 1-2 minutes. This will output to console and hence avoid Travis build timeout
357-
2. Use `travis_wait` function provided by Travis-CI. You can prefix `browserstack-runner` command by `travis-wait` in your `travis.yml` file
354+
355+
1. Run a script which does `console.log` every 1-2 minutes. This will output to console and hence avoid Travis build timeout
356+
2. Use `travis_wait` function provided by Travis-CI. You can prefix `browserstack-runner` command by `travis-wait` in your `travis.yml` file
358357

359358
We would recommend using `travis_wait` function. It also allows you to configure wait time (ex: `travis_wait 20 browserstack-runner`, this will extend wait time to 20 minutes). Read more about `travis_wait` [here](https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received)

0 commit comments

Comments
 (0)
Please sign in to comment.