Don't load plugins in tests
This can affect the test behavior and results.
This commit is contained in:
parent
e098df0766
commit
e4e0ac43b0
|
@ -9,7 +9,7 @@ main() {
|
||||||
# information. We must also run it from the root otherwise coverage will not
|
# information. We must also run it from the root otherwise coverage will not
|
||||||
# include our source files.
|
# include our source files.
|
||||||
cd "$OLDPWD"
|
cd "$OLDPWD"
|
||||||
./test/node_modules/.bin/jest "$@"
|
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|
|
@ -114,10 +114,14 @@ export const register = async (
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!process.env.CS_DISABLE_PLUGINS) {
|
||||||
const workingDir = args._ && args._.length > 0 ? path.resolve(args._[args._.length - 1]) : undefined
|
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)
|
const pluginApi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH, workingDir)
|
||||||
await pluginApi.loadPlugins()
|
await pluginApi.loadPlugins()
|
||||||
pluginApi.mount(app, wsApp)
|
pluginApi.mount(app, wsApp)
|
||||||
|
app.use("/api/applications", apps.router(pluginApi))
|
||||||
|
wrapper.onDispose(() => pluginApi.dispose())
|
||||||
|
}
|
||||||
|
|
||||||
app.use(bodyParser.json())
|
app.use(bodyParser.json())
|
||||||
app.use(bodyParser.urlencoded({ extended: true }))
|
app.use(bodyParser.urlencoded({ extended: true }))
|
||||||
|
@ -141,9 +145,6 @@ export const register = async (
|
||||||
app.use("/static", _static.router)
|
app.use("/static", _static.router)
|
||||||
app.use("/update", update.router)
|
app.use("/update", update.router)
|
||||||
|
|
||||||
app.use("/api/applications", apps.router(pluginApi))
|
|
||||||
wrapper.onDispose(() => pluginApi.dispose())
|
|
||||||
|
|
||||||
app.use(() => {
|
app.use(() => {
|
||||||
throw new HttpError("Not Found", HttpCode.NotFound)
|
throw new HttpError("Not Found", HttpCode.NotFound)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue