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 5dd9e6f

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

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
22
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
34
# Contributing
45

56
- [Pull Requests](#pull-requests)
@@ -9,6 +10,10 @@
910
- [Updating VS Code](#updating-vs-code)
1011
- [Notes about Changes](#notes-about-changes)
1112
- [Build](#build)
13+
- [Testing](#testing)
14+
- [Unit Tests](#unit-tests)
15+
- [Integration Tests](#integration-tests)
16+
- [End-to-End Tests](#end-to-end-tests)
1217
- [Structure](#structure)
1318
- [Modifications to VS Code](#modifications-to-vs-code)
1419
- [Currently Known Issues](#currently-known-issues)
@@ -112,6 +117,43 @@ In our GitHub Actions CI, we use CentOS 7 for maximum compatibility.
112117
If you need your builds to support older distros, run the build commands
113118
inside a Docker container with all the build requirements installed.
114119

120+
## Testing
121+
122+
There are three kinds of tests in code-server:
123+
124+
1. unit tests
125+
2. integration tests
126+
3. end-to-end tests
127+
128+
### Unit Tests
129+
130+
Our unit tests are written in TypeScript and run using [Jest](https://jestjs.io/), which is a JavaScript testing framework.
131+
132+
These live under [test/unit](../test/unit).
133+
134+
We use unit tests for functions and things that can be tested in isolation.
135+
136+
### Integration Tests
137+
138+
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)
139+
which ensures that code-server's CLI is working.
140+
141+
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.
142+
143+
### End-to-End Tests
144+
145+
The end-to-end (e2e) are written in TypeScript and run using [Playwright](https://playwright.dev/).
146+
147+
These live under [test/e2e](../test/e2e).
148+
149+
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.
150+
151+
Take a look at `codeServer.test.ts` to see how you use it (look at `test.use`).
152+
153+
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.
154+
155+
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.
156+
115157
## Structure
116158

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

0 commit comments

Comments
(0)

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