chore: Fix unit tests failing due to using require.context in unit tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-04-20 10:58:08 -04:00
1 parent e7b8e63053
commit d984e9e305
2 files changed
+14 -2

No files matched your search

@@ -0,0 +1,12 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getGlobalOverride } from "@k8slens/test-utils";
import lensCreateResourceTemplatesInjectable from "./lens-templates.injectable";
export default getGlobalOverride(lensCreateResourceTemplatesInjectable, () => ({
label: "lens",
options: [],
}));
@@ -6,13 +6,12 @@ import { getInjectable } from "@ogre-tools/injectable";
import type { RawTemplates } from "./create-resource-templates.injectable";
import parsePathInjectable from "../../../../common/path/parse.injectable";
const templatesContext = require.context("@k8slens/resource-templates/templates", true, /^\.\/.*\.(yaml|yml)$/);
const lensCreateResourceTemplatesInjectable = getInjectable({
id: "lens-create-resource-templates",
instantiate: (di): RawTemplates => {
const parsePath = di.inject(parsePathInjectable);
const templatesContext = require.context("@k8slens/resource-templates/templates", true, /^\.\/.*\.(yaml|yml)$/);
return {
label: "lens",
@@ -23,6 +22,7 @@ const lensCreateResourceTemplatesInjectable = getInjectable({
})),
};
},
causesSideEffects: true,
});
export default lensCreateResourceTemplatesInjectable;