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:
@ -1,4 +1,5 @@
|
||||
{
|
||||
"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 fs from "fs"
|
||||
import * as path from "path"
|
||||
import { HttpCode } from "../../src/common/http"
|
||||
import { AuthType } from "../../src/node/cli"
|
||||
import { codeServer, PluginAPI } from "../../src/node/plugin"
|
||||
import * as apps from "../../src/node/routes/apps"
|
||||
import * as httpserver from "../utils/httpserver"
|
||||
import { HttpCode } from "../../../src/common/http"
|
||||
import { AuthType } from "../../../src/node/cli"
|
||||
import { codeServer, PluginAPI } from "../../../src/node/plugin"
|
||||
import * as apps from "../../../src/node/routes/apps"
|
||||
import * as httpserver from "../../utils/httpserver"
|
||||
const fsp = fs.promises
|
||||
|
||||
// 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 fspath from "path"
|
||||
|
||||
type FixMeLater = any
|
||||
|
||||
export const plugin: cs.Plugin = {
|
||||
displayName: "Test Plugin",
|
||||
routerPath: "/test-plugin",
|
||||
homepageURL: "https://example.com",
|
||||
description: "Plugin used in code-server tests.",
|
||||
|
||||
init(config: FixMeLater) {
|
||||
init(config) {
|
||||
config.logger.debug("test-plugin loaded!")
|
||||
},
|
||||
|
||||
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"))
|
||||
})
|
||||
r.get("/goland/icon.svg", (_: FixMeLater, res: FixMeLater) => {
|
||||
r.get("/goland/icon.svg", (_, res) => {
|
||||
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
|
||||
})
|
||||
r.get("/error", () => {
|
||||
@ -29,8 +27,8 @@ export const plugin: cs.Plugin = {
|
||||
|
||||
wsRouter() {
|
||||
const wr = cs.WsRouter()
|
||||
wr.ws("/test-app", (req: FixMeLater) => {
|
||||
cs.wss.handleUpgrade(req, req.ws, req.head, (ws: FixMeLater) => {
|
||||
wr.ws("/test-app", (req) => {
|
||||
cs.wss.handleUpgrade(req, req.ws, req.head, (ws) => {
|
||||
req.ws.resume()
|
||||
ws.send("hello")
|
||||
})
|
Reference in New Issue
Block a user