Skip to content

Commit

Permalink
3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shirish87 committed Mar 6, 2024
1 parent 6512110 commit e31e0da
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
29 changes: 28 additions & 1 deletion docs/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,36 @@ Example below shows use of npm `pre` and `post` scripts in `package.json` to sta

```

However, if the npm `start` command exits with an error, the `poststart` script is never executed, and the BrowserStackLocal binary is left running on your system. You can cleanup all binaries by running `browserstack-local stop`.

A better option is to use `browserstack run-with -- <your-command>`.

This will:
- Start the local binary
- Set `BROWSERSTACK_LOCAL_IDENTIFIER` environment variable for `<your-command>`
- Run `<your-command>` _synchronously_ as a child process inheriting `std*`
- Stop the local binary after `<your-command>` ends
- Exit with the exit code of `<your-command>`

```json
{
"name": "your-package",
"version": "1.0.0",
"main": "index.js",
"scripts": {
// use %npm_package_name% to pass your package name as localIdentifier on Windows
"test": "browserstack-local run-with $npm_package_name -- playwright test",
},
"devDependencies": {
"browserstack-client": "latest"
}
}

```

Optionally, you may supply a `localIdentifier` that distinguishes your current project from other local projects being tested on BrowserStack.

`browserstack-local (start|stop) [local-identifier]`
`browserstack-local (start|stop|run-with) [local-identifier]`

> Calling `browserstack-local stop` without a local-identifier will terminate all locally running instances of the binary that have previously been started by `browserstack-local start`.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browserstack-client",
"version": "3.4.0",
"version": "3.5.0",
"description": "BrowserStack APIs client library for node.js",
"type": "module",
"main": "./dist/browserstack-client.umd.cjs",
Expand Down

0 comments on commit e31e0da

Please sign in to comment.