Skip to content

Commit 45c5f65

Browse files
Copilotabdurriq
andauthored
docs: document how to run all tests locally in CONTRIBUTING.md
Co-authored-by: abdurriq <[email protected]> Agent-Logs-Url: https://github.com/devcontainers/features/sessions/503f04fe-7fc2-4cb6-830c-6c008e0821a4
1 parent 56b0dbe commit 45c5f65

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,50 @@ started:
4646
👩‍⚖️ When contributing code to this project, you may be asked to agree to our
4747
[Contributor License Agreement].
4848

49+
## Testing
50+
51+
The [devcontainer CLI] is used to run the tests in this repository. Install it with:
52+
53+
```bash
54+
npm install -g @devcontainers/cli
55+
```
56+
57+
### Run all tests
58+
59+
To run the tests for **every** Feature in this repository, run the following commands from the root of the repository:
60+
61+
```bash
62+
# Run auto-generated and scenario tests for every Feature
63+
devcontainer features test .
64+
65+
# Run the global test scenarios
66+
devcontainer features test --global-scenarios-only .
67+
```
68+
69+
### Test a specific Feature
70+
71+
To test a specific Feature (e.g. `go`):
72+
73+
```bash
74+
devcontainer features test -f go .
75+
```
76+
77+
### Test against a specific base image
78+
79+
By default tests run against `mcr.microsoft.com/devcontainers/base:ubuntu`. Use the `--base-image` (or `-i`) flag to specify a different image:
80+
81+
```bash
82+
devcontainer features test -f go -i ubuntu:focal .
83+
```
84+
85+
### Run only scenario tests
86+
87+
Use `--skip-autogenerated` to run only the [scenario tests] defined in `test/<feature>/scenarios.json`:
88+
89+
```bash
90+
devcontainer features test -f go --skip-autogenerated .
91+
```
92+
4993
<!-- prettier-ignore-start -->
5094
[our dev container community Slack channel]: https://aka.ms/devcontainer_community
5195
[open an issue]: https://github.com/devcontainers/features/issues/new
@@ -57,4 +101,6 @@ started:
57101
[contributor license agreement]: https://opensource.microsoft.com/cla/
58102
[Test your changes using `devcontainer features test`]: https://github.com/devcontainers/cli/blob/main/docs/features/test.md
59103
[semver]: https://semver.org/
104+
[devcontainer CLI]: https://github.com/devcontainers/cli
105+
[scenario tests]: https://github.com/devcontainers/cli/blob/main/docs/features/test.md#scenarios
60106
<!-- prettier-ignore-end -->

0 commit comments

Comments
 (0)