mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Add check for incomplete SelfSubjectRulesReview to fix GKE Signed-off-by: Sebastian Malton <sebastian@malton.name> * Adding namespaced for KubeApiResource Signed-off-by: Sebastian Malton <sebastian@malton.name> * Refactoring of AuthorizationNamespaceReview Signed-off-by: Sebastian Malton <sebastian@malton.name> * Removing dead code Signed-off-by: Sebastian Malton <sebastian@malton.name> * Refactoring ListApiResources Signed-off-by: Sebastian Malton <sebastian@malton.name> * Extract ClusterContext into deps for KubeObjectStore to fix circular import Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix remaining type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix crash in frame by consolidating setup into runnables Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type errors and remove dead code Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix core resources not showing up Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix namespaces not being shown Signed-off-by: Sebastian Malton <sebastian@malton.name> * Simplify ClusterContext to remove something only NamespaceStore needs Signed-off-by: Sebastian Malton <sebastian@malton.name> * Make sure the public API doesn't change Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix lint Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixing namespace-select-filter tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix other tests requiring overrides Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix kludge in cluster-frame tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix remaining test failures Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix integration test due to incorrect casting Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix integration test and kube watches not working at all Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix secret details test Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix lint Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix non-ApplicationBuilder tests by adding overrides Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix crash due to trying to read hostedCluster too soon Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix crash due to timing issues - Make injectable phases more explicit for renderer Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
|
|
import { configure } from "mobx";
|
|
import { setImmediate } from "timers";
|
|
import { TextEncoder, TextDecoder as TextDecoderNode } from "util";
|
|
import glob from "glob";
|
|
import path from "path";
|
|
import { enableMapSet, setAutoFreeze } from "immer";
|
|
|
|
configure({
|
|
// Needed because we want to use jest.spyOn()
|
|
// ref https://github.com/mobxjs/mobx/issues/2784
|
|
safeDescriptors: false,
|
|
enforceActions: "never",
|
|
});
|
|
|
|
setAutoFreeze(false); // allow to merge mobx observables
|
|
enableMapSet(); // allow to merge maps and sets
|
|
|
|
// Mock __non_webpack_require__ for tests
|
|
globalThis.__non_webpack_require__ = jest.fn();
|
|
|
|
global.setImmediate = setImmediate;
|
|
|
|
global.fail = ((error = "Test failed without explicit error") => {
|
|
console.error(error);
|
|
}) as any;
|
|
|
|
process.on("unhandledRejection", (err: any) => {
|
|
global.fail(err);
|
|
});
|
|
|
|
global.TextEncoder = TextEncoder;
|
|
global.TextDecoder = TextDecoderNode as unknown as typeof TextDecoder;
|
|
|
|
global.ResizeObserver = class {
|
|
observe = () => {};
|
|
unobserve = () => {};
|
|
disconnect = () => {};
|
|
};
|
|
|
|
jest.mock("./renderer/components/monaco-editor/monaco-editor");
|
|
jest.mock("./renderer/components/tooltip/withTooltip");
|
|
|
|
jest.mock("monaco-editor");
|
|
|
|
const getInjectables = (environment: "renderer" | "main", filePathGlob: string) => [
|
|
...glob.sync(`./{common,extensions,${environment}}/**/${filePathGlob}`, {
|
|
cwd: __dirname,
|
|
}),
|
|
|
|
...glob.sync(`./features/**/{${environment},common}/**/${filePathGlob}`, {
|
|
cwd: __dirname,
|
|
}),
|
|
].map(x => path.resolve(__dirname, x));
|
|
|
|
(global as any).rendererInjectablePaths = getInjectables("renderer", "*.{injectable,injectable.testing-env}.{ts,tsx}");
|
|
(global as any).rendererGlobalOverridePaths = getInjectables("renderer", "*.global-override-for-injectable.{ts,tsx}");
|
|
(global as any).mainInjectablePaths = getInjectables("main", "*.{injectable,injectable.testing-env}.{ts,tsx}");
|
|
(global as any).mainGlobalOverridePaths = getInjectables("main", "*.global-override-for-injectable.{ts,tsx}");
|