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 ca56440

Browse files
authored
Merge pull request #2852 from cdr/jsjoeio-2646-separate-testing
dev(testing): separate unit and e2e tests
2 parents 0506875 + 7e23575 commit ca56440

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+136
-76
lines changed

‎.github/workflows/ci.yaml‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ jobs:
2727
with:
2828
args: ./ci/steps/lint.sh
2929

30-
test:
30+
test-unit:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v1
34+
- name: Run unit tests
35+
uses: ./ci/images/debian10
36+
with:
37+
args: ./ci/steps/test-unit.sh
38+
test-e2e:
3139
needs: linux-amd64
3240
runs-on: ubuntu-latest
3341
env:
@@ -44,19 +52,19 @@ jobs:
4452
run: |
4553
cd release-packages && tar -xzf code-server*-linux-amd64.tar.gz
4654
- uses: microsoft/playwright-github-action@v1
47-
- name: Install dependencies and run tests
55+
- name: Install dependencies and run end-to-end tests
4856
run: |
4957
./release-packages/code-server*-linux-amd64/bin/code-server --home $CODE_SERVER_ADDRESS/healthz &
5058
yarn --frozen-lockfile
51-
yarn test
59+
yarn test:e2e
5260
- name: Upload test artifacts
5361
if: always()
5462
uses: actions/upload-artifact@v2
5563
with:
5664
name: test-videos
57-
path: ./test/videos
65+
path: ./test/e2e/videos
5866
- name: Remove release packages and test artifacts
59-
run: rm -rf ./release-packages ./test/videos
67+
run: rm -rf ./release-packages ./test/e2e/videos
6068

6169
release:
6270
runs-on: ubuntu-latest

‎.gitignore‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ node-*
1616
.home
1717
coverage
1818
**/.DS_Store
19-
test/videos
20-
test/screenshots
19+
test/e2e/videos
20+
test/e2e/screenshots

‎ci/README.md‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Make sure you have `$GITHUB_TOKEN` set and [hub](https://github.com/github/hub)
5252

5353
Currently, we run a command to manually generate the code coverage shield. Follow these steps:
5454

55-
1. Run `yarn test` and make sure all the tests are passing
55+
1. Run `yarn test:unit` and make sure all the tests are passing
5656
2. Run `yarn badges`
5757
3. Go into the README and change the color from `red` to `green` in this line:
5858

@@ -72,8 +72,10 @@ This directory contains scripts used for the development of code-server.
7272
- Runs formatters.
7373
- [./ci/dev/lint.sh](./dev/lint.sh) (`yarn lint`)
7474
- Runs linters.
75-
- [./ci/dev/test.sh](./dev/test.sh) (`yarn test`)
76-
- Runs tests.
75+
- [./ci/dev/test-unit.sh](./dev/test-unit.sh) (`yarn test:unit`)
76+
- Runs unit tests.
77+
- [./ci/dev/test-e2e.sh](./dev/test-e2e.sh) (`yarn test:e2e`)
78+
- Runs end-to-end tests.
7779
- [./ci/dev/ci.sh](./dev/ci.sh) (`yarn ci`)
7880
- Runs `yarn fmt`, `yarn lint` and `yarn test`.
7981
- [./ci/dev/watch.ts](./dev/watch.ts) (`yarn watch`)
@@ -142,11 +144,13 @@ This directory contains the scripts used in CI.
142144
Helps avoid clobbering the CI configuration.
143145

144146
- [./steps/fmt.sh](./steps/fmt.sh)
145-
- Runs `yarn fmt` after ensuring VS Code is patched.
147+
- Runs `yarn fmt`.
146148
- [./steps/lint.sh](./steps/lint.sh)
147-
- Runs `yarn lint` after ensuring VS Code is patched.
148-
- [./steps/test.sh](./steps/test.sh)
149-
- Runs `yarn test` after ensuring VS Code is patched.
149+
- Runs `yarn lint`.
150+
- [./steps/test-unit.sh](./steps/test-unit.sh)
151+
- Runs `yarn test:unit`.
152+
- [./steps/test-e2e.sh](./steps/test-e2e.sh)
153+
- Runs `yarn test:e2e`.
150154
- [./steps/release.sh](./steps/release.sh)
151155
- Runs the release process.
152156
- Generates the npm package at `./release`.

‎ci/dev/ci.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ main() {
66

77
yarn fmt
88
yarn lint
9-
yarn test
9+
yarn test:unit
1010
}
1111

1212
main "$@"

‎ci/dev/test.sh‎ renamed to ‎ci/dev/test-e2e.sh‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ set -euo pipefail
33

44
main() {
55
cd "$(dirname "0ドル")/../.."
6-
cd test/test-plugin
7-
make -s out/index.js
86
# We must keep jest in a sub-directory. See ../../test/package.json for more
97
# information. We must also run it from the root otherwise coverage will not
108
# include our source files.
11-
cd "$OLDPWD"
129
if [[ -z ${PASSWORD-} ]] || [[ -z ${CODE_SERVER_ADDRESS-} ]]; then
1310
echo "The end-to-end testing suites rely on your local environment"
1411
echo -e "\n"
@@ -21,7 +18,7 @@ main() {
2118
echo -e "\n"
2219
exit 1
2320
fi
24-
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@"
21+
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --config ./test/jest.e2e.config.ts
2522
}
2623

2724
main "$@"

‎ci/dev/test-unit.sh‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
main() {
5+
cd "$(dirname "0ドル")/../.."
6+
cd test/unit/test-plugin
7+
make -s out/index.js
8+
# We must keep jest in a sub-directory. See ../../test/package.json for more
9+
# information. We must also run it from the root otherwise coverage will not
10+
# include our source files.
11+
cd "$OLDPWD"
12+
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@"
13+
}
14+
15+
main "$@"

‎ci/steps/test-e2e.sh‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
main() {
5+
cd "$(dirname "0ドル")/../.."
6+
7+
"./release-packages/code-server*-linux-amd64/bin/code-server" --home "$CODE_SERVER_ADDRESS"/healthz &
8+
yarn --frozen-lockfile
9+
yarn test:e2e
10+
}
11+
12+
main "$@"

‎ci/steps/test.sh‎ renamed to ‎ci/steps/test-unit.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ main() {
66

77
yarn --frozen-lockfile
88

9-
yarn test
9+
yarn test:unit
1010
}
1111

1212
main "$@"

‎package.json‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
"release:standalone": "./ci/build/build-standalone-release.sh",
1717
"release:github-draft": "./ci/build/release-github-draft.sh",
1818
"release:github-assets": "./ci/build/release-github-assets.sh",
19+
"test:e2e": "./ci/dev/test-e2e.sh",
1920
"test:standalone-release": "./ci/build/test-standalone-release.sh",
21+
"test:unit": "./ci/dev/test-unit.sh",
2022
"package": "./ci/build/build-packages.sh",
2123
"postinstall": "./ci/dev/postinstall.sh",
2224
"update:vscode": "./ci/dev/update-vscode.sh",
@@ -124,7 +126,8 @@
124126
"testPathIgnorePatterns": [
125127
"node_modules",
126128
"lib",
127-
"out"
129+
"out",
130+
"test/e2e"
128131
],
129132
"collectCoverage": true,
130133
"collectCoverageFrom": [
@@ -144,8 +147,6 @@
144147
"lines": 40
145148
}
146149
},
147-
"testTimeout": 30000,
148-
"globalSetup": "<rootDir>/test/globalSetup.ts",
149150
"modulePathIgnorePatterns": [
150151
"<rootDir>/lib/vscode",
151152
"<rootDir>/release-packages",
@@ -156,7 +157,7 @@
156157
"<rootDir>/release-images"
157158
],
158159
"moduleNameMapper": {
159-
"^.+\\.(css|less)$": "<rootDir>/test/cssStub.ts"
160+
"^.+\\.(css|less)$": "<rootDir>/test/utils/cssStub.ts"
160161
}
161162
}
162163
}

‎test/e2e.test.ts‎ renamed to ‎test/e2e/e2e.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { chromium, Page, Browser } from "playwright"
2-
import { CODE_SERVER_ADDRESS } from "./constants"
2+
import { CODE_SERVER_ADDRESS } from "../utils/constants"
33

44
let browser: Browser
55
let page: Page

0 commit comments

Comments
(0)

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