-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vitest-provider-browserstack documentation
- Loading branch information
1 parent
ff2e84e
commit 1a248c2
Showing
4 changed files
with
161 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Browserstack provider for Vitest | ||
|
||
A browser provider for [Vitest](https://vitest.dev/) that runs tests on [Browserstack](https://www.browserstack.com/). | ||
|
||
### Install | ||
|
||
::: code-group | ||
|
||
```sh[npm] | ||
npm i -D @chialab/vitest-provider-browserstack | ||
``` | ||
|
||
```sh[yarn] | ||
yarn add -D @chialab/vitest-provider-browserstack | ||
``` | ||
|
||
```sh[pnpm] | ||
pnpm add -D @chialab/vitest-provider-browserstack | ||
``` | ||
|
||
::: | ||
|
||
### Requirements | ||
|
||
In order to use this provider, you need to have a Browserstack account and a valid access key. | ||
|
||
### Usage | ||
|
||
Use this module as provider for Vitest browser runner: | ||
|
||
```ts | ||
/// <reference types="@chialab/vitest-provider-browserstack" /> | ||
|
||
export default { | ||
test: { | ||
browser: { | ||
name: 'browserstack:chrome-latest', | ||
// Use the browserstack provider. | ||
provider: '@chialab/vitest-provider-browserstack', | ||
// We need to expose the server to the network in order to let Browserstack access it. | ||
api: { | ||
host: '0.0.0.0', | ||
port: 5176, | ||
}, | ||
// Hijack ESM imports is unstable on older browsers. | ||
slowHijackESM: false, | ||
}, | ||
}, | ||
browserstack: { | ||
options: { | ||
user: 'YOUR_BROWSERSTACK_USERNAME', | ||
key: 'YOUR_BROWSERSTACK_ACCESS_KEY', | ||
}, | ||
capabilities: { | ||
'chrome-latest': { | ||
'browserName': 'Chrome', | ||
'bstack:options': { | ||
browserVersion: 'latest', | ||
}, | ||
}, | ||
'firefox-latest': { | ||
'browserName': 'Firefox', | ||
'bstack:options': { | ||
browserVersion: 'latest', | ||
}, | ||
}, | ||
'safari-latest': { | ||
'browserName': 'Safari', | ||
'bstack:options': { | ||
browserVersion: 'latest', | ||
}, | ||
}, | ||
'edge-latest': { | ||
'browserName': 'MicrosoftEdge', | ||
'bstack:options': { | ||
browserVersion: 'latest', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` | ||
|
||
### Options | ||
|
||
`user` and `key` options can be omitted if you have a `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` environment variables set. | ||
|
||
Read more about the capabilities configuration at [Browserstack documentation](https://www.browserstack.com/docs/automate/capabilities) and Webdriverio [capabilities](https://webdriver.io/docs/capabilities/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"name": "@chialab/vitest-provider-browserstack", | ||
"type": "module", | ||
"version": "0.18.0", | ||
"description": "A BrowserStack provider for vitest browser runner.", | ||
"description": "A BrowserStack provider for Vitest browser runner.", | ||
"main": "lib/index.js", | ||
"typings": "./types/index.d.ts", | ||
"author": "Chialab <[email protected]> (https://www.chialab.it)", | ||
|
@@ -12,7 +12,11 @@ | |
"url": "https://github.com/chialab/rna", | ||
"directory": "packages/vitest-provider-browserstack" | ||
}, | ||
"keywords": [], | ||
"keywords": [ | ||
"vitest", | ||
"browserstack", | ||
"webdriver" | ||
], | ||
"files": [ | ||
"lib", | ||
"types", | ||
|