mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Remove mac-ca usage since it was only in tests (#6043) * Make injecting CAs injectable, remove mac-ca as dependency * Fix win-ca failing on electron renderer on windows * Fix the matcher under features/ for main Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type errors from new types Signed-off-by: Sebastian Malton <sebastian@malton.name> * Temp change to see windows errors on CI Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix temp change Signed-off-by: Sebastian Malton <sebastian@malton.name> * Change error message for windows Signed-off-by: Sebastian Malton <sebastian@malton.name> * Increase maxBuffer size when reading windows CAs Signed-off-by: Sebastian Malton <sebastian@malton.name> * Switch back to running integration tests on windows Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix usage after rebase Signed-off-by: Sebastian Malton <sebastian@malton.name> * Update lock file Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
|
|
import configurePackages from "./common/configure-packages";
|
|
import { configure } from "mobx";
|
|
import { setImmediate } from "timers";
|
|
import { TextEncoder, TextDecoder as TextDecoderNode } from "util";
|
|
import glob from "glob";
|
|
import path from "path";
|
|
|
|
// setup default configuration for external npm-packages
|
|
configurePackages();
|
|
|
|
configure({
|
|
// Needed because we want to use jest.spyOn()
|
|
// ref https://github.com/mobxjs/mobx/issues/2784
|
|
safeDescriptors: false,
|
|
});
|
|
|
|
// 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");
|
|
|
|
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}");
|