mirror of
https://github.com/coder/code-server.git
synced 2024-12-24 10:12:15 +03:00
Load only test plugin during tests
The other plugins in my path were causing the tests to fail.
This commit is contained in:
parent
f6b04c7c29
commit
fb37473e72
@ -118,7 +118,7 @@ export class PluginAPI {
|
|||||||
* loadPlugins loads all plugins based on this.csPlugin,
|
* loadPlugins loads all plugins based on this.csPlugin,
|
||||||
* this.csPluginPath and the built in plugins.
|
* this.csPluginPath and the built in plugins.
|
||||||
*/
|
*/
|
||||||
public async loadPlugins(): Promise<void> {
|
public async loadPlugins(loadBuiltin = true): Promise<void> {
|
||||||
for (const dir of this.csPlugin.split(":")) {
|
for (const dir of this.csPlugin.split(":")) {
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
continue
|
continue
|
||||||
@ -133,8 +133,9 @@ export class PluginAPI {
|
|||||||
await this._loadPlugins(dir)
|
await this._loadPlugins(dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Built-in plugins.
|
if (loadBuiltin) {
|
||||||
await this._loadPlugins(path.join(__dirname, "../../plugins"))
|
await this._loadPlugins(path.join(__dirname, "../../plugins"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,8 +15,10 @@ describe("plugin", () => {
|
|||||||
let s: httpserver.HttpServer
|
let s: httpserver.HttpServer
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
papi = new PluginAPI(logger, `${path.resolve(__dirname, "test-plugin")}:meow`)
|
// Only include the test plugin to avoid contaminating results with other
|
||||||
await papi.loadPlugins()
|
// plugins that might be on the filesystem.
|
||||||
|
papi = new PluginAPI(logger, `${path.resolve(__dirname, "test-plugin")}:meow`, "")
|
||||||
|
await papi.loadPlugins(false)
|
||||||
|
|
||||||
const app = express.default()
|
const app = express.default()
|
||||||
papi.mount(app)
|
papi.mount(app)
|
||||||
|
Loading…
Reference in New Issue
Block a user