Skip to content

Commit

Permalink
browser utils
Browse files Browse the repository at this point in the history
  • Loading branch information
xnerhu committed Oct 23, 2024
1 parent 6b3b0de commit 7a7e423
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ If you want to fix a bug, create a signal source, or make any other code contrib
After you clone the repository, check the [Working with code](#working-with-code) section to learn how to run, check, and build the code.

In order for us to review and accept your code contributions, please follow these rules:

- Your code quality should be at least as good as the code you modify.
- Your code style (syntax, naming, coding patterns, etc) should follow the BotD style.
- All the new code should be covered with automated tests.
Expand Down Expand Up @@ -74,7 +75,7 @@ Development playground lets you run BotD locally. Run this command to start a pl
yarn dev:playground # Add '--port 8765' to change the server port
```

Then open http://localhost:3000 in a browser.
Then open <http://localhost:3000> in a browser.
BotD will execute immediately and print the result on the page.
The page reloads every time you change the source code.
The code of the playground itself is located in the [playground](playground) directory.
Expand Down Expand Up @@ -114,6 +115,7 @@ Unit test files are located right next to individual module files that they chec
Integration tests are located in the `tests` directory.

To run the tests in a browser on your machine, build the project and run:

```bash
yarn test:local --browsers ChromeHeadless
# or to run in Firefox
Expand All @@ -123,12 +125,14 @@ yarn test:local
```

To run the tests in browsers on [BrowserStack](https://www.browserstack.com), get a BrowserStack access key and run:

```bash
# For Linux, macOS and WSL (Linux on Windows)
BROWSERSTACK_USERNAME=your-username BROWSERSTACK_ACCESS_KEY=your-key yarn test:browserstack
```

If you face `Error: spawn Unknown system error -86` on macOS, try installing Rosetta:

```bash
softwareupdate --install-rosetta
```
Expand Down Expand Up @@ -200,6 +204,9 @@ In the event of significant changes or deprecation of the underlying APIs, these

For inspiration see existing tests in [src/sources/](src/sources/).

If your signal/detector is environment-specific, look at [browser utils](src/utils/browser.ts).
You can also use browser utils in tests, [example](src/sources/notification_permissions.test.ts).

### How to publish

See the [publishing guide](docs/publishing.md) (for BotD maintainers only).

0 comments on commit 7a7e423

Please sign in to comment.