Skip to content

Commit 7d43eaa

Browse files
committed
Revert "refactor: move test-plugin to integration suite"
This reverts commit bc02005. I couldn't get past some GLIBC errors in CI so moving back to unit tests.
1 parent 9a1cd34 commit 7d43eaa

13 files changed

+20
-19
lines changed

ci/dev/test-integration.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ main() {
2424
path="$CODE_SERVER_PATH"
2525
fi
2626

27-
echo "Building test plugin"
28-
pushd test/integration/test-plugin
29-
make -s out/index.js
30-
popd
31-
3227
echo "Running tests with code-server binary: '$path'"
3328

3429
if [[ ! -f $path ]]; then
@@ -38,7 +33,7 @@ main() {
3833
exit 1
3934
fi
4035

41-
CODE_SERVER_PATH="$path" CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration" --testPathIgnorePatterns "./test/integration/fixtures" --testPathIgnorePatterns "./test/integration/test-plugin"
36+
CODE_SERVER_PATH="$path" CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration" --testPathIgnorePatterns "./test/integration/fixtures"
4237
}
4338

4439
main "$@"

ci/dev/test-unit.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ main() {
66

77
source ./ci/lib.sh
88

9+
# TODO@jsjoeio - skip if already built
10+
# TODO@jsjoeio - move to integration test suite too
11+
echo "Building test plugin"
12+
pushd test/unit/node/test-plugin
13+
make -s out/index.js
14+
popd
15+
916
# Our code imports from `out` in order to work during development but if you
1017
# have only built for production you will have not have this directory. In
1118
# that case symlink `out` to a production build directory.

test/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"extends": "../tsconfig.json",
3-
"include": ["./**/*.ts"]
3+
"include": ["./**/*.ts"],
4+
"exclude": ["./unit/node/test-plugin"]
45
}

test/integration/plugin.test.ts renamed to test/unit/node/plugin.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { logger } from "@coder/logger"
22
import * as express from "express"
33
import * as fs from "fs"
44
import * as path from "path"
5-
import { HttpCode } from "../../src/common/http"
6-
import { AuthType } from "../../src/node/cli"
7-
import { codeServer, PluginAPI } from "../../src/node/plugin"
8-
import * as apps from "../../src/node/routes/apps"
9-
import * as httpserver from "../utils/httpserver"
5+
import { HttpCode } from "../../../src/common/http"
6+
import { AuthType } from "../../../src/node/cli"
7+
import { codeServer, PluginAPI } from "../../../src/node/plugin"
8+
import * as apps from "../../../src/node/routes/apps"
9+
import * as httpserver from "../../utils/httpserver"
1010
const fsp = fs.promises
1111

1212
// Jest overrides `require` so our usual override doesn't work.

test/integration/test-plugin/src/index.ts renamed to test/unit/node/test-plugin/src/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
import * as cs from "code-server"
22
import * as fspath from "path"
33

4-
type FixMeLater = any
5-
64
export const plugin: cs.Plugin = {
75
displayName: "Test Plugin",
86
routerPath: "/test-plugin",
97
homepageURL: "https://example.com",
108
description: "Plugin used in code-server tests.",
119

12-
init(config: FixMeLater) {
10+
init(config) {
1311
config.logger.debug("test-plugin loaded!")
1412
},
1513

1614
router() {
1715
const r = cs.express.Router()
18-
r.get("/test-app", (_: FixMeLater, res: FixMeLater) => {
16+
r.get("/test-app", (_, res) => {
1917
res.sendFile(fspath.resolve(__dirname, "../public/index.html"))
2018
})
21-
r.get("/goland/icon.svg", (_: FixMeLater, res: FixMeLater) => {
19+
r.get("/goland/icon.svg", (_, res) => {
2220
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
2321
})
2422
r.get("/error", () => {
@@ -29,8 +27,8 @@ export const plugin: cs.Plugin = {
2927

3028
wsRouter() {
3129
const wr = cs.WsRouter()
32-
wr.ws("/test-app", (req: FixMeLater) => {
33-
cs.wss.handleUpgrade(req, req.ws, req.head, (ws: FixMeLater) => {
30+
wr.ws("/test-app", (req) => {
31+
cs.wss.handleUpgrade(req, req.ws, req.head, (ws) => {
3432
req.ws.resume()
3533
ws.send("hello")
3634
})

0 commit comments

Comments
 (0)