Skip to content

Commit 4619786

Browse files
authored
Merge pull request #4274 from cdr/jsjoeio-testing-guidelines
docs: update section around testing
2 parents 1dfcd04 + b9989ca commit 4619786

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

docs/CONTRIBUTING.md

+15-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
- [Development workflow](#development-workflow)
99
- [Updates to VS Code](#updates-to-vs-code)
1010
- [Build](#build)
11-
- [Test](#test)
11+
- [Test](#test)
1212
- [Unit tests](#unit-tests)
13+
- [Script tests](#script-tests)
1314
- [Integration tests](#integration-tests)
1415
- [End-to-end tests](#end-to-end-tests)
1516
- [Structure](#structure)
@@ -129,13 +130,14 @@ yarn package
129130
> If you need your builds to support older distros, run the build commands
130131
> inside a Docker container with all the build requirements installed.
131132
132-
### Test
133+
## Test
133134

134-
There are three kinds of tests in code-server:
135+
There are four kinds of tests in code-server:
135136

136137
1. Unit tests
137-
2. Integration tests
138-
3. End-to-end tests
138+
2. Script tests
139+
3. Integration tests
140+
4. End-to-end tests
139141

140142
### Unit tests
141143

@@ -146,6 +148,14 @@ These live under [test/unit](../test/unit).
146148

147149
We use unit tests for functions and things that can be tested in isolation. The file structure is modeled closely after `/src` so it's easy for people to know where test files should live.
148150

151+
### Script tests
152+
153+
Our script tests are written in bash and run using [bats](https://github.com/bats-core/bats-core).
154+
155+
These tests live under `test/scripts`.
156+
157+
We use these to test anything related to our scripts (most of which live under `ci`).
158+
149159
### Integration tests
150160

151161
These are a work in progress. We build code-server and run a script called

docs/MAINTAINING.md

+15
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [Docker](#docker)
2020
- [Homebrew](#homebrew)
2121
- [npm](#npm)
22+
- [Testing](#testing)
2223
- [Documentation](#documentation)
2324
- [Troubleshooting](#troubleshooting)
2425

@@ -214,6 +215,20 @@ We publish code-server as a npm package [here](https://www.npmjs.com/package/cod
214215

215216
This is currently automated with the release process.
216217

218+
## Testing
219+
220+
Our testing structure is laid out under our [Contributing docs](https://coder.com/docs/code-server/latest/CONTRIBUTING#test).
221+
222+
We hope to eventually hit 100% test converage with our unit tests, and maybe one day our scripts (coverage not tracked currently).
223+
224+
If you're ever looking to add more tests, here are a few ways to get started:
225+
226+
- run `yarn test:unit` and look at the coverage chart. You'll see all the uncovered lines. This is a good place to start.
227+
- look at `test/scripts` to see which scripts are tested. We can always use more tests there.
228+
- look at `test/e2e`. We can always use more end-to-end tests.
229+
230+
Otherwise, talk to a current maintainer and ask which part of the codebase is lacking most when it comes to tests.
231+
217232
## Documentation
218233

219234
### Troubleshooting

0 commit comments

Comments
 (0)