Skip to content

Commit de11753

Browse files
committed
Fill req.args for tests
1 parent 0abbc97 commit de11753

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/plugin.test.ts

+23
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as express from "express"
33
import * as fs from "fs"
44
import * as path from "path"
55
import { HttpCode } from "../src/common/http"
6+
import { AuthType } from "../src/node/cli"
67
import { codeServer, PluginAPI } from "../src/node/plugin"
78
import * as apps from "../src/node/routes/apps"
89
import * as httpserver from "./httpserver"
@@ -26,6 +27,28 @@ describe("plugin", () => {
2627

2728
const app = express.default()
2829
const wsApp = express.default()
30+
31+
const common: express.RequestHandler = (req, _, next) => {
32+
// Routes might use these arguments.
33+
req.args = {
34+
_: [],
35+
auth: AuthType.None,
36+
host: "localhost",
37+
port: 8080,
38+
"proxy-domain": [],
39+
config: "~/.config/code-server/config.yaml",
40+
verbose: false,
41+
usingEnvPassword: false,
42+
usingEnvHashedPassword: false,
43+
"extensions-dir": "",
44+
"user-data-dir": "",
45+
}
46+
next()
47+
}
48+
49+
app.use(common)
50+
wsApp.use(common)
51+
2952
papi.mount(app, wsApp)
3053
app.use("/api/applications", apps.router(papi))
3154

0 commit comments

Comments
 (0)