Quick change to make sure the client lib always served correctly in test.
This commit is contained in:
parent
e9ceff42d5
commit
f16fe2d8d2
|
@ -11,13 +11,17 @@ const router = Router()
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
router.param("file", async (file, ctx, next) => {
|
router.param("file", async (file, ctx, next) => {
|
||||||
ctx.file = file && file.includes(".") ? file : "index.html"
|
ctx.file = file && file.includes(".") ? file : "index.html"
|
||||||
|
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
|
// Serving the client library from your local dir in dev
|
||||||
if (env.isDev() && ctx.file.startsWith("budibase-client")) {
|
|
||||||
ctx.devPath = budibaseTempDir()
|
ctx.devPath = budibaseTempDir()
|
||||||
}
|
}
|
||||||
|
return next()
|
||||||
await next()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router
|
router
|
||||||
|
|
Loading…
Reference in New Issue