Attempting to solve component library issue permanently in test.

This commit is contained in:
mike12345567 2021-03-25 15:19:41 +00:00
parent 1cf0027c6e
commit e9ceff42d5
1 changed files with 3 additions and 2 deletions

View File

@ -162,8 +162,9 @@ exports.getComponentLibraryManifest = async (appId, library) => {
// when testing in cypress and so on we need to get the package // 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 // as the environment may not be fully fleshed out for dev or prod
if (env.isTest()) { if (env.isTest()) {
const paths = await downloadLibraries(appId) const lib = library.split("/")[1]
return require(join(paths[library], "package", filename)) const path = require.resolve(library).split(lib)[0]
return require(join(path, lib, filename))
} }
const devPath = join(budibaseTempDir(), library, filename) const devPath = join(budibaseTempDir(), library, filename)
if (env.isDev() && fs.existsSync(devPath)) { if (env.isDev() && fs.existsSync(devPath)) {