1
0
Fork 0
mirror of synced 2024-07-03 05:20:32 +12:00

Quick change to make sure the client lib always served correctly in test.

This commit is contained in:
mike12345567 2021-03-25 16:08:09 +00:00
parent 8d23152562
commit f7d14a8110

View file

@ -11,13 +11,17 @@ const router = Router()
/* istanbul ignore next */
router.param("file", async (file, ctx, next) => {
ctx.file = file && file.includes(".") ? file : "index.html"
// Serving the client library from your local dir in dev
if (env.isDev() && ctx.file.startsWith("budibase-client")) {
if (!ctx.file.startsWith("budibase-client")) {
return next()
}
// test serves from require
if (env.isTest()) {
ctx.devPath = require.resolve("@budibase/client").split(ctx.file)[0]
} else if (env.isDev()) {
// Serving the client library from your local dir in dev
ctx.devPath = budibaseTempDir()
}
await next()
return next()
})
router