未验证 提交 e4e0ac43 编写于 作者: A Asher

Don't load plugins in tests

This can affect the test behavior and results.
上级 e098df07
......@@ -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 "$@"
......@@ -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)
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册