Removing requirement for built client library in component test case.
This commit is contained in:
parent
906d614c64
commit
2e80bab7ad
|
@ -2,9 +2,9 @@ import { DocumentType } from "../../db/utils"
|
|||
import { Plugin } from "@budibase/types"
|
||||
import { db as dbCore, context, tenancy } from "@budibase/backend-core"
|
||||
import { getComponentLibraryManifest } from "../../utilities/fileSystem"
|
||||
import { BBContext } from "@budibase/types"
|
||||
import { UserCtx } from "@budibase/types"
|
||||
|
||||
export async function fetchAppComponentDefinitions(ctx: BBContext) {
|
||||
export async function fetchAppComponentDefinitions(ctx: UserCtx) {
|
||||
try {
|
||||
const db = context.getAppDB()
|
||||
const app = await db.get(DocumentType.APP_METADATA)
|
||||
|
|
|
@ -33,15 +33,8 @@ export const deleteApp = async (appId: string) => {
|
|||
export const getComponentLibraryManifest = async (library: string) => {
|
||||
const appId = context.getAppId()
|
||||
const filename = "manifest.json"
|
||||
/* istanbul ignore next */
|
||||
// when testing in cypress and so on we need to get the package
|
||||
// as the environment may not be fully fleshed out for dev or prod
|
||||
if (env.isTest()) {
|
||||
library = library.replace("standard-components", "client")
|
||||
const lib = library.split("/")[1]
|
||||
const path = require.resolve(library).split(lib)[0]
|
||||
return require(join(path, lib, filename))
|
||||
} else if (env.isDev()) {
|
||||
|
||||
if (env.isDev() || env.isTest()) {
|
||||
const path = join(NODE_MODULES_PATH, "@budibase", "client", filename)
|
||||
// always load from new so that updates are refreshed
|
||||
delete require.cache[require.resolve(path)]
|
||||
|
|
Loading…
Reference in New Issue