Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d9bb1a3

Browse files
committed
docs(contr): add section on testing
1 parent 5f7e9b7 commit d9bb1a3

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ VS Code v0.00.0
6060
- chore: update node to v14 #3458 @oxy
6161
- chore: update .gitignore #3557 @cuining
6262
- fix: use sufficient computational effort for password hash #3422 @jsjoeio
63+
- docs(CONTRIBUTING): add section on testing #3629 @jsjoeio
6364

6465
### Development
6566

‎docs/CONTRIBUTING.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
- [Updating VS Code](#updating-vs-code)
1010
- [Notes about Changes](#notes-about-changes)
1111
- [Build](#build)
12+
- [Testing](#testing)
13+
- [Unit Tests](#unit-tests)
14+
- [Integration Tests](#integration-tests)
15+
- [End-to-End Tests](#end-to-end-tests)
1216
- [Structure](#structure)
1317
- [Modifications to VS Code](#modifications-to-vs-code)
1418
- [Currently Known Issues](#currently-known-issues)
@@ -112,6 +116,43 @@ In our GitHub Actions CI, we use CentOS 7 for maximum compatibility.
112116
If you need your builds to support older distros, run the build commands
113117
inside a Docker container with all the build requirements installed.
114118

119+
## Testing
120+
121+
There are three kinds of tests in code-server:
122+
123+
1. unit tests
124+
2. integration tests
125+
3. end-to-end tests
126+
127+
### Unit Tests
128+
129+
Our unit tests are written in TypeScript and run using [Jest, the testing framework](https://jestjs.io/).
130+
131+
These live under [test/unit](../test/unit).
132+
133+
We use unit tests for functions and things that can be tested in isolation.
134+
135+
### Integration Tests
136+
137+
These are a work-in-progress. We build code-server and run a script called [test-standalone-release.sh`](../ci/build/test-standalone-release.sh)
138+
which ensures that code-server's CLI is working.
139+
140+
Integration for us means testing things that integrate and rely on each other. For instance, testing the CLI which requires that code-server be built and packaged.
141+
142+
### End-to-End Tests
143+
144+
The end-to-end (e2e) are written in TypeScript and run using [Playwright](https://playwright.dev/).
145+
146+
These live under [test/e2e](../test/e2e).
147+
148+
Before the e2e tests run, we have a `globalSetup` that runs which makes it so you don't have to login before each test and can reuse the authentication state.
149+
150+
Take a look at `codeServer.test.ts` to see how you use it (look at `test.use`).
151+
152+
We also have a model where you can create helpers to use within tests. Take a look at [models/CodeServer.ts](../test/e2e/models/CodeServer.ts) to see an example.
153+
154+
Generally speaking, e2e means testing code-server running in the browser, similar to how a user would interact with it. When running these tests with `yarn test:e2e`, you must have code-server running locally. In CI, this is taken care of for you.
155+
115156
## Structure
116157

117158
The `code-server` script serves an HTTP API for login and starting a remote VS Code process.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /