diff --git a/ci/dev/test.sh b/ci/dev/test.sh index 6b0acd02..851aa0d3 100755 --- a/ci/dev/test.sh +++ b/ci/dev/test.sh @@ -9,7 +9,7 @@ main() { # information. We must also run it from the root otherwise coverage will not # include our source files. cd "$OLDPWD" - ./test/node_modules/.bin/jest "$@" + CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" } main "$@" diff --git a/src/node/routes/index.ts b/src/node/routes/index.ts index f91c7576..d04eac34 100644 --- a/src/node/routes/index.ts +++ b/src/node/routes/index.ts @@ -114,10 +114,14 @@ export const register = async ( }) }) - const workingDir = args._ && args._.length > 0 ? path.resolve(args._[args._.length - 1]) : undefined - const pluginApi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH, workingDir) - await pluginApi.loadPlugins() - pluginApi.mount(app, wsApp) + if (!process.env.CS_DISABLE_PLUGINS) { + const workingDir = args._ && args._.length > 0 ? path.resolve(args._[args._.length - 1]) : undefined + const pluginApi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH, workingDir) + await pluginApi.loadPlugins() + pluginApi.mount(app, wsApp) + app.use("/api/applications", apps.router(pluginApi)) + wrapper.onDispose(() => pluginApi.dispose()) + } app.use(bodyParser.json()) app.use(bodyParser.urlencoded({ extended: true })) @@ -141,9 +145,6 @@ export const register = async ( app.use("/static", _static.router) app.use("/update", update.router) - app.use("/api/applications", apps.router(pluginApi)) - wrapper.onDispose(() => pluginApi.dispose()) - app.use(() => { throw new HttpError("Not Found", HttpCode.NotFound) })