Skip to content

Commit

Permalink
Update tests readmes (#3776)
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed Mar 1, 2024
1 parent 7374357 commit ee0450c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
8 changes: 5 additions & 3 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ npm test
Note that for Linux you'll need to prefix test commands with `xvfb-run -a` for example `xvfb-run -a npm run test`
Note that some tests rely on the built project and will not pass until you have run `npm run build-dist`.

To run individual tests:
To run specific tests:

- Unit tests: `npx jest path/to/file.test.ts` (e.g. `npx jest src/style/style_layer.test.ts`)
- Render tests: `npm run test-render -- render-test-name` (e.g. `npm run test-render -- text-rotation-alignment`)
- Unit test by file name : `npx jest path/to/file.test.ts --reporters=default` (e.g. `npx jest src/style/style_layer.test.ts`)
- Unit test that matches a test name: `npx jest path/to/file.test.ts --reporters=default -t "test name"`
- Browser test that matches a test name: `npx jest test/integration/browser/browser.test.ts --reporters=default -t "test name"`, in some cases here you might want to change the headeless mode in the test file to be `false` to see what's happening in the browser.
- Render tests that matches a folder or file names: `npm run test-render -- render-test-name` (e.g. `npm run test-render -- text-rotation-alignment`)

To run folders in watch mode, meaning they will run continuously as you make changes to relevant code, (i.e. for test driven development): use `npm run test-watch-roots *folder1* [*folder2*...]` (e.g. `npm run test-watch-roots ./src/ui/control`)

Expand Down
8 changes: 4 additions & 4 deletions test/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Additionally, it may be helpful to use a visual jest frontend (e.g. `npx majesti

To run a subset of tests or an individual test, you can pass a specific subdirectory to the `test-render` script. For example, to run all the tests for a given property, e.g. `circle-radius`:
```
$ npm run test-render circle-radius
$ npm run test-render -- circle-radius
...
* passed circle-radius/antimeridian
* passed circle-radius/default
Expand All @@ -73,7 +73,7 @@ Done in 2.71s.
```
Or to run a single test:
```
$ npm run test-render circle-radius/literal
$ npm run test-render -- circle-radius/literal
...
* passed circle-radius/literal
1 passed (100.0%)
Expand All @@ -83,7 +83,7 @@ Done in 2.32s.
### Detailed debug messages for render tests
Render tests are executed in browser, and by default console messages are hidden. If need to see them, please pass <code>--debug</code> parameter:
```
$ npm run test-render raster-masking/overlapping-zoom -- --debug
$ npm run test-render -- raster-masking/overlapping-zoom --debug
```

### Viewing render test results
Expand All @@ -106,7 +106,7 @@ open ./test/integration/render/results.html

If want to skip the report, please pass <code>--skip-report</code> parameter
```
$ npm run test-render circle-radius/literal -- --skip-report
$ npm run test-render -- circle-radius/literal --skip-report
```

### Updating results of render test results
Expand Down
14 changes: 0 additions & 14 deletions test/integration/browser/README.md

This file was deleted.

0 comments on commit ee0450c

Please sign in to comment.