From 4e310b4985367a331538abf1a6428634e6c0f1fc Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Wed, 29 Sep 2021 14:53:25 -0700 Subject: [PATCH 1/2] docs(CONTRIBUTING): add scrip tests section --- docs/CONTRIBUTING.md | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 684bc16f2..4c3e52e01 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,20 +1,23 @@ + # Contributing -- [Requirements](#requirements) -- [Creating pull requests](#creating-pull-requests) - - [Commits and commit history](#commits-and-commit-history) -- [Development workflow](#development-workflow) - - [Updates to VS Code](#updates-to-vs-code) - - [Build](#build) +- [Contributing](#contributing) + - [Requirements](#requirements) + - [Creating pull requests](#creating-pull-requests) + - [Commits and commit history](#commits-and-commit-history) + - [Development workflow](#development-workflow) + - [Updates to VS Code](#updates-to-vs-code) + - [Build](#build) - [Test](#test) - - [Unit tests](#unit-tests) - - [Integration tests](#integration-tests) - - [End-to-end tests](#end-to-end-tests) -- [Structure](#structure) - - [Modifications to VS Code](#modifications-to-vs-code) - - [Currently Known Issues](#currently-known-issues) + - [Unit tests](#unit-tests) + - [Script tests](#script-tests) + - [Integration tests](#integration-tests) + - [End-to-end tests](#end-to-end-tests) + - [Structure](#structure) + - [Modifications to VS Code](#modifications-to-vs-code) + - [Currently Known Issues](#currently-known-issues) @@ -129,13 +132,14 @@ yarn package > If you need your builds to support older distros, run the build commands > inside a Docker container with all the build requirements installed. -### Test +## Test -There are three kinds of tests in code-server: +There are four kinds of tests in code-server: 1. Unit tests -2. Integration tests -3. End-to-end tests +2. Script tests +3. Integration tests +4. End-to-end tests ### Unit tests @@ -146,6 +150,14 @@ These live under [test/unit](../test/unit). 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. +### Script tests + +Our script tests are written in bash and run using [bats](https://github.com/bats-core/bats-core). + +These tests live under `test/scripts`. + +We use these to test anything related to our scripts (most of which live under `ci`). + ### Integration tests These are a work in progress. We build code-server and run a script called From b9989ca2dbbb36a427310b8738c15bd42f61fecd Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Wed, 29 Sep 2021 14:59:17 -0700 Subject: [PATCH 2/2] docs(MAINTAINING): add Testing section --- docs/CONTRIBUTING.md | 30 ++++++++++++++---------------- docs/MAINTAINING.md | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 4c3e52e01..f15dd2f00 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,23 +1,21 @@ - # Contributing -- [Contributing](#contributing) - - [Requirements](#requirements) - - [Creating pull requests](#creating-pull-requests) - - [Commits and commit history](#commits-and-commit-history) - - [Development workflow](#development-workflow) - - [Updates to VS Code](#updates-to-vs-code) - - [Build](#build) - - [Test](#test) - - [Unit tests](#unit-tests) - - [Script tests](#script-tests) - - [Integration tests](#integration-tests) - - [End-to-end tests](#end-to-end-tests) - - [Structure](#structure) - - [Modifications to VS Code](#modifications-to-vs-code) - - [Currently Known Issues](#currently-known-issues) +- [Requirements](#requirements) +- [Creating pull requests](#creating-pull-requests) + - [Commits and commit history](#commits-and-commit-history) +- [Development workflow](#development-workflow) + - [Updates to VS Code](#updates-to-vs-code) + - [Build](#build) +- [Test](#test) + - [Unit tests](#unit-tests) + - [Script tests](#script-tests) + - [Integration tests](#integration-tests) + - [End-to-end tests](#end-to-end-tests) +- [Structure](#structure) + - [Modifications to VS Code](#modifications-to-vs-code) + - [Currently Known Issues](#currently-known-issues) diff --git a/docs/MAINTAINING.md b/docs/MAINTAINING.md index a131c73a5..466e6121d 100644 --- a/docs/MAINTAINING.md +++ b/docs/MAINTAINING.md @@ -19,6 +19,7 @@ - [Docker](#docker) - [Homebrew](#homebrew) - [npm](#npm) +- [Testing](#testing) - [Documentation](#documentation) - [Troubleshooting](#troubleshooting) @@ -214,6 +215,20 @@ We publish code-server as a npm package [here](https://www.npmjs.com/package/cod This is currently automated with the release process. +## Testing + +Our testing structure is laid out under our [Contributing docs](https://coder.com/docs/code-server/latest/CONTRIBUTING#test). + +We hope to eventually hit 100% test converage with our unit tests, and maybe one day our scripts (coverage not tracked currently). + +If you're ever looking to add more tests, here are a few ways to get started: + +- run `yarn test:unit` and look at the coverage chart. You'll see all the uncovered lines. This is a good place to start. +- look at `test/scripts` to see which scripts are tested. We can always use more tests there. +- look at `test/e2e`. We can always use more end-to-end tests. + +Otherwise, talk to a current maintainer and ask which part of the codebase is lacking most when it comes to tests. + ## Documentation ### Troubleshooting