Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add instructions on running individual tests #6686

Merged
merged 1 commit into from
May 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build/run-tap
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/usr/bin/env bash
if [ "$#" == 5 ]; then
arg="${@:0:4} ${BASH_ARGV[1]}/${BASH_ARGV[0]}"
else
arg="${@}"
fi

node_modules/.bin/tap --node-arg -r --node-arg @mapbox/flow-remove-types/register --node-arg -r --node-arg @std/esm ${@}
node_modules/.bin/tap --node-arg -r --node-arg @mapbox/flow-remove-types/register --node-arg -r --node-arg @std/esm $arg
5 changes: 5 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ There are two test suites associated with Mapbox GL JS
- `yarn test` runs quick unit tests
- `yarn run test-suite` runs slower integration tests

To run individual tests:

- Unit tests: `yarn test-unit path/to/file.test.js` where the path begins within the `/test/unit/` directory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just been doing build/run-tap test/unit/path/to/file.test.js. That has the advantage the semi-fragile argument processing stuff in run-tap -- but are there downsides I'm not thinking of?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just that it’s maybe easier to remember because it more closely matches the behavior of running single render tests 🤷‍♀️

- Render tests: `yarn test-render render-test-name`

## Writing Unit Tests

- **You must not share variables between test cases.** All test fixtures must be wrapped in `create` functions. This ensures each test is run in an isolated environment.
Expand Down