-
Notifications
You must be signed in to change notification settings - Fork 5.9k
refactor: move integration tests to Jest #5275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✨ code-server docs for PR #5275 is ready! It will be updated on every commit.
|
Codecov Report
@@ Coverage Diff @@
## main #5275 +/- ##
=======================================
Coverage 72.47% 72.47%
=======================================
Files 30 30
Lines 1671 1671
Branches 367 367
=======================================
Hits 1211 1211
Misses 397 397
Partials 63 63 Continue to review full report at Codecov.
|
possible workaround is to manually checkout submodules |
e25edab
to
8bb7cfe
Compare
.github/workflows/ci.yaml
Outdated
- name: Install test dependencies | ||
run: yarn install --ignore-scripts && cd test && yarn install | ||
|
||
- name: Run integration tests on standalone release | ||
run: yarn test:integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: I had to use --ignore-scripts
because otherwise yarn install
fails if you don't checkout the repo with submodules. On the Linux job that runs on CentOS7, it didn't have the latest git
so this one-liner was the best alternative. It ensures we have the right TS/Jest dependencies to run the yarn test:integration
step.
@@ -34,7 +34,7 @@ jobs: | |||
run: ./install.sh | |||
|
|||
- name: Test code-server | |||
run: yarn test:standalone-release code-server | |||
run: CODE_SERVER_PATH="code-server" yarn test:integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we install code-server in these steps, we need to tell the integration tests to look at code-server
and use the CLI/binary.
fe376a1
to
0539413
Compare
844bcca
to
f76acab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to see this move into our standard testing framework!
test/integration/fixtures/wesbos.theme-cobalt2-2.1.6/.vsixmanifest
Outdated
Show resolved
Hide resolved
Co-authored-by: Asher <[email protected]>
Co-authored-by: Asher <[email protected]>
Co-authored-by: Asher <[email protected]>
Co-authored-by: Asher <[email protected]>
*/ | ||
export async function runCodeServerCommand(argv: string[]): Promise<{ stdout: string; stderr: string }> { | ||
const CODE_SERVER_COMMAND = process.env.CODE_SERVER_PATH || "/var/tmp/coder/code-server/bin/code-server" | ||
const { stdout, stderr } = await promisify(exec)(`${CODE_SERVER_COMMAND} ${argv.join(" ")}`) |
Check warning
Code scanning / CodeQL
Shell command built from environment values
Co-authored-by: Asher <[email protected]>
Co-authored-by: Asher <[email protected]>
Co-authored-by: Asher <[email protected]>
Co-authored-by: Asher <[email protected]>
Description
This PR refactors our integration tests to be written in TypeScript and run with Jest instead of bash. It also adds a helper inspired by the Next.js team to make it easy to test code-server commands.
Motivation
We currently only have one integration test and it's not easy to write new ones because Bash and it's all in one file.
This should make it easier to write integration tests, specifically around the CLI. This is also prep work for #5031
Before
Here is what our integration tests looked like:
After
This is what they'll look like moving forward:
Fixes N/A