mirror of https://github.com/coder/code-server.git
Revert "refactor: move test-plugin to integration suite"
This reverts commit bc02005dc0
.
I couldn't get past some GLIBC errors in CI so moving back to unit
tests.
This commit is contained in:
parent
9a1cd349a1
commit
7d43eaac95
|
@ -24,11 +24,6 @@ main() {
|
||||||
path="$CODE_SERVER_PATH"
|
path="$CODE_SERVER_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Building test plugin"
|
|
||||||
pushd test/integration/test-plugin
|
|
||||||
make -s out/index.js
|
|
||||||
popd
|
|
||||||
|
|
||||||
echo "Running tests with code-server binary: '$path'"
|
echo "Running tests with code-server binary: '$path'"
|
||||||
|
|
||||||
if [[ ! -f $path ]]; then
|
if [[ ! -f $path ]]; then
|
||||||
|
@ -38,7 +33,7 @@ main() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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"
|
CODE_SERVER_PATH="$path" CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration" --testPathIgnorePatterns "./test/integration/fixtures"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|
|
@ -6,6 +6,13 @@ main() {
|
||||||
|
|
||||||
source ./ci/lib.sh
|
source ./ci/lib.sh
|
||||||
|
|
||||||
|
# TODO@jsjoeio - skip if already built
|
||||||
|
# TODO@jsjoeio - move to integration test suite too
|
||||||
|
echo "Building test plugin"
|
||||||
|
pushd test/unit/node/test-plugin
|
||||||
|
make -s out/index.js
|
||||||
|
popd
|
||||||
|
|
||||||
# Our code imports from `out` in order to work during development but if you
|
# Our code imports from `out` in order to work during development but if you
|
||||||
# have only built for production you will have not have this directory. In
|
# have only built for production you will have not have this directory. In
|
||||||
# that case symlink `out` to a production build directory.
|
# that case symlink `out` to a production build directory.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"include": ["./**/*.ts"]
|
"include": ["./**/*.ts"],
|
||||||
|
"exclude": ["./unit/node/test-plugin"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ import { logger } from "@coder/logger"
|
||||||
import * as express from "express"
|
import * as express from "express"
|
||||||
import * as fs from "fs"
|
import * as fs from "fs"
|
||||||
import * as path from "path"
|
import * as path from "path"
|
||||||
import { HttpCode } from "../../src/common/http"
|
import { HttpCode } from "../../../src/common/http"
|
||||||
import { AuthType } from "../../src/node/cli"
|
import { AuthType } from "../../../src/node/cli"
|
||||||
import { codeServer, PluginAPI } from "../../src/node/plugin"
|
import { codeServer, PluginAPI } from "../../../src/node/plugin"
|
||||||
import * as apps from "../../src/node/routes/apps"
|
import * as apps from "../../../src/node/routes/apps"
|
||||||
import * as httpserver from "../utils/httpserver"
|
import * as httpserver from "../../utils/httpserver"
|
||||||
const fsp = fs.promises
|
const fsp = fs.promises
|
||||||
|
|
||||||
// Jest overrides `require` so our usual override doesn't work.
|
// Jest overrides `require` so our usual override doesn't work.
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
@ -1,24 +1,22 @@
|
||||||
import * as cs from "code-server"
|
import * as cs from "code-server"
|
||||||
import * as fspath from "path"
|
import * as fspath from "path"
|
||||||
|
|
||||||
type FixMeLater = any
|
|
||||||
|
|
||||||
export const plugin: cs.Plugin = {
|
export const plugin: cs.Plugin = {
|
||||||
displayName: "Test Plugin",
|
displayName: "Test Plugin",
|
||||||
routerPath: "/test-plugin",
|
routerPath: "/test-plugin",
|
||||||
homepageURL: "https://example.com",
|
homepageURL: "https://example.com",
|
||||||
description: "Plugin used in code-server tests.",
|
description: "Plugin used in code-server tests.",
|
||||||
|
|
||||||
init(config: FixMeLater) {
|
init(config) {
|
||||||
config.logger.debug("test-plugin loaded!")
|
config.logger.debug("test-plugin loaded!")
|
||||||
},
|
},
|
||||||
|
|
||||||
router() {
|
router() {
|
||||||
const r = cs.express.Router()
|
const r = cs.express.Router()
|
||||||
r.get("/test-app", (_: FixMeLater, res: FixMeLater) => {
|
r.get("/test-app", (_, res) => {
|
||||||
res.sendFile(fspath.resolve(__dirname, "../public/index.html"))
|
res.sendFile(fspath.resolve(__dirname, "../public/index.html"))
|
||||||
})
|
})
|
||||||
r.get("/goland/icon.svg", (_: FixMeLater, res: FixMeLater) => {
|
r.get("/goland/icon.svg", (_, res) => {
|
||||||
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
|
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
|
||||||
})
|
})
|
||||||
r.get("/error", () => {
|
r.get("/error", () => {
|
||||||
|
@ -29,8 +27,8 @@ export const plugin: cs.Plugin = {
|
||||||
|
|
||||||
wsRouter() {
|
wsRouter() {
|
||||||
const wr = cs.WsRouter()
|
const wr = cs.WsRouter()
|
||||||
wr.ws("/test-app", (req: FixMeLater) => {
|
wr.ws("/test-app", (req) => {
|
||||||
cs.wss.handleUpgrade(req, req.ws, req.head, (ws: FixMeLater) => {
|
cs.wss.handleUpgrade(req, req.ws, req.head, (ws) => {
|
||||||
req.ws.resume()
|
req.ws.resume()
|
||||||
ws.send("hello")
|
ws.send("hello")
|
||||||
})
|
})
|
Loading…
Reference in New Issue