Skip to content

Commit e4e0ac4

Browse files
committed
Don't load plugins in tests
This can affect the test behavior and results.
1 parent e098df0 commit e4e0ac4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

ci/dev/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ main() {
99
# information. We must also run it from the root otherwise coverage will not
1010
# include our source files.
1111
cd "$OLDPWD"
12-
./test/node_modules/.bin/jest "$@"
12+
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@"
1313
}
1414

1515
main "$@"

src/node/routes/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,14 @@ export const register = async (
114114
})
115115
})
116116

117-
const workingDir = args._ && args._.length > 0 ? path.resolve(args._[args._.length - 1]) : undefined
118-
const pluginApi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH, workingDir)
119-
await pluginApi.loadPlugins()
120-
pluginApi.mount(app, wsApp)
117+
if (!process.env.CS_DISABLE_PLUGINS) {
118+
const workingDir = args._ && args._.length > 0 ? path.resolve(args._[args._.length - 1]) : undefined
119+
const pluginApi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH, workingDir)
120+
await pluginApi.loadPlugins()
121+
pluginApi.mount(app, wsApp)
122+
app.use("/api/applications", apps.router(pluginApi))
123+
wrapper.onDispose(() => pluginApi.dispose())
124+
}
121125

122126
app.use(bodyParser.json())
123127
app.use(bodyParser.urlencoded({ extended: true }))
@@ -141,9 +145,6 @@ export const register = async (
141145
app.use("/static", _static.router)
142146
app.use("/update", update.router)
143147

144-
app.use("/api/applications", apps.router(pluginApi))
145-
wrapper.onDispose(() => pluginApi.dispose())
146-
147148
app.use(() => {
148149
throw new HttpError("Not Found", HttpCode.NotFound)
149150
})

0 commit comments

Comments
 (0)