Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
ed6f522
Fix failing to start shell being hidden from user
Nokel81 Jun 14, 2022
87dc14c
Cleanup
Nokel81 Oct 13, 2022
dba4f59
Add enough code to get first couple terminal tests to pass
Nokel81 Oct 14, 2022
8136e23
Fix type errors from testing in dev mode
Nokel81 Oct 14, 2022
f111450
Introduce and use ApplicationBuilder.quit in afterEach() hooks
Nokel81 Oct 14, 2022
c9f1594
Upgrade XTermJs to v5 to get snapshot testing working
Nokel81 Oct 17, 2022
2de3068
Use webgl when available, add search and better weblinks
Nokel81 Oct 17, 2022
d293554
Get tests passing
Nokel81 Oct 18, 2022
988307e
Add script to download the correct version of canvas
Nokel81 Oct 18, 2022
071ba8a
Fix installing canvas on all platforms
Nokel81 Oct 18, 2022
ea603c7
Fix the script
Nokel81 Oct 18, 2022
78b05ba
Remove console logs
Nokel81 Oct 18, 2022
aa41117
Fix lint
Nokel81 Oct 18, 2022
19466f1
Temporarily upgrade to beta version of xterm to verify fix
Nokel81 Oct 26, 2022
d1acca4
Fix post install script because of temp version of xterm
Nokel81 Oct 26, 2022
f2d19e7
Fix some more lint
Nokel81 Oct 26, 2022
2a96eb8
Fix usage of new asyncComputed type
Nokel81 Oct 28, 2022
862cd2a
Update (mostly just) snapshots and a few other tests
Nokel81 Oct 31, 2022
3c9791e
Fix type error
Nokel81 Nov 1, 2022
c340256
Replace last use of customRequestPromise with di
Nokel81 Nov 3, 2022
f522d23
Replace usage of request in setupLensProxy
Nokel81 Nov 3, 2022
37955f0
Replace usage of request in k8sRequest and cluster detectors
Nokel81 Nov 3, 2022
b86bc6d
Remove direct dependency on request et al
Nokel81 Nov 3, 2022
4c1d076
Add process of cleaning up lens proxy startup if down quickly
Nokel81 Nov 3, 2022
c6a9d56
Fix bad vscode rename
Nokel81 Nov 3, 2022
e49b0f6
Remove calls to show error popup on stopping
Nokel81 Nov 3, 2022
d173e45
Fix starting of lens proxy
Nokel81 Nov 3, 2022
b96e115
Fix type errors
Nokel81 Nov 7, 2022
6ce833c
Make ApplicationBuilder.quit more realistic
Nokel81 Nov 8, 2022
0dabbb6
Replace override of catalogSyncToRenderer with a global override
Nokel81 Nov 8, 2022
a82a120
Fix many tests by changing injectables
Nokel81 Nov 8, 2022
e90a181
Fix listing-active-helm-repositories-in-preferences.test.ts
Nokel81 Nov 8, 2022
9c75199
Update snapshot
Nokel81 Nov 8, 2022
97dfe4d
Fix new tests
Nokel81 Nov 8, 2022
e8bc887
Fix postinstall script
Nokel81 Nov 14, 2022
58cbf5f
Fix bad imports of node-fetch
Nokel81 Nov 14, 2022
8761aa1
Fix type errors
Nokel81 Nov 14, 2022
8fd732b
Fix unit tests
Nokel81 Nov 15, 2022
e9e248e
Fix tests not stopping by forcing cleanup
Nokel81 Nov 18, 2022
71ad8e1
Generate tray icons before installing canvas
Nokel81 Nov 18, 2022
3a7ac10
Add updated icons
Nokel81 Nov 18, 2022
c11d8c6
Fix lint
Nokel81 Nov 18, 2022
0088add
Fix code after rebase
Nokel81 Nov 24, 2022
6321b10
Fix test failures
Nokel81 Nov 24, 2022
9683a7c
Fix tests and lint
Nokel81 Nov 29, 2022
a271c83
Update snapshots
Nokel81 Nov 29, 2022
3b72137
Remove unused (but newly added) dep
Nokel81 Dec 1, 2022
19a8691
Update snapshots
Nokel81 Dec 1, 2022
f6b5214
Fixup new test file after rebase
Nokel81 Dec 6, 2022
78614af
Update snapshots
Nokel81 Dec 6, 2022
56703cd
Update snapshots
Nokel81 Dec 6, 2022
a1d2fa0
Fix lint
Nokel81 Dec 15, 2022
3fbbf02
Fix errors blocking compilation
Nokel81 Dec 16, 2022
8b18e58
Update snapshots
Nokel81 Dec 20, 2022
d9a7a48
Fix lint
Nokel81 Dec 20, 2022
ea49929
Fix types
Nokel81 Dec 21, 2022
0e1b2c0
Fix test failures
Nokel81 Dec 21, 2022
12bd506
Fix lint
Nokel81 Jan 5, 2023
2f43d24
Fix build
Nokel81 Jan 9, 2023
14f50a3
Fix unit tests
Nokel81 Jan 9, 2023
6d0e527
Fix build type errors
Nokel81 Jan 9, 2023
d22af76
Fix most tests
Nokel81 Jan 9, 2023
3492741
Fix kubeconfig-manager tests
Nokel81 Jan 9, 2023
6dd926a
Fix tests not using ApplicationBuilder
Nokel81 Jan 9, 2023
cfad2c0
Fix expected URL
Nokel81 Jan 9, 2023
186d7f9
Fix tests not using ApplicationBuilder
Nokel81 Jan 9, 2023
9adddaf
Fix top bar tests
Nokel81 Jan 9, 2023
e88743d
Add suspend plugin
Nokel81 Jan 9, 2023
4885461
More work to get tests to pass in a more realistic way
Nokel81 Jan 9, 2023
120a5f7
Fix tests by faking the version detector
Nokel81 Jan 10, 2023
91cd2c8
Remove debug logging
Nokel81 Jan 10, 2023
7971755
Cleanup uses and overrides of requestAnimationFrame
Nokel81 Jan 10, 2023
c658a0b
Get terminal tests to pass again
Nokel81 Jan 10, 2023
9b7e77d
Remove unneccessary causesSideEffects
Nokel81 Jan 10, 2023
4815510
Update cluster-frame test snapshots
Nokel81 Jan 10, 2023
3471397
Fix edit-namespace-from-new-tab tests
Nokel81 Jan 10, 2023
e77411a
Fix tests failing due to allow resources not updateing
Nokel81 Jan 10, 2023
d1eb149
Fix tooltip tests
Nokel81 Jan 10, 2023
6880d52
Update install-helm-chart-from-new-tab snapshots
Nokel81 Jan 10, 2023
d2ee54f
Update showing-details-for-helm-release snapshots
Nokel81 Jan 10, 2023
8704067
Update sidebar-and-tab-navigation-for-extensions snapshots
Nokel81 Jan 10, 2023
9539c1c
Fix cluster-store tests
Nokel81 Jan 10, 2023
5f30b81
Fix kube-auth-proxy tests
Nokel81 Jan 10, 2023
4edfa40
Update more snapshots
Nokel81 Jan 10, 2023
29a7e2a
Fix kube-api-version-detection tests
Nokel81 Jan 10, 2023
51b8c91
Fix build
Nokel81 Jan 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 14 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@
"<rootDir>/packages"
],
"setupFiles": [
"<rootDir>/src/jest.setup.ts",
"jest-canvas-mock"
"<rootDir>/src/jest.setup.ts"
],
"globalSetup": "<rootDir>/src/jest.timezone.ts",
"setupFilesAfterEnv": [
Expand Down Expand Up @@ -265,7 +264,7 @@
"immer": "^9.0.17",
"joi": "^17.7.0",
"js-yaml": "^4.1.0",
"jsdom": "^16.7.0",
"jsdom": "^20.0.1",
"lodash": "^4.17.15",
"marked": "^4.2.5",
"md5-file": "^5.0.0",
Expand Down Expand Up @@ -301,8 +300,7 @@
"win-ca": "^3.5.0",
"winston": "^3.8.2",
"winston-transport-browserconsole": "^1.0.5",
"ws": "^8.12.0",
"xterm-link-provider": "^1.3.1"
"ws": "^8.12.0"
},
"devDependencies": {
"@async-fn/jest": "1.6.4",
Expand Down Expand Up @@ -335,6 +333,7 @@
"@types/html-webpack-plugin": "^3.2.6",
"@types/http-proxy": "^1.17.9",
"@types/jest": "^28.1.6",
"@types/jest-image-snapshot": "^5.1.0",
"@types/js-yaml": "^4.0.5",
"@types/jsdom": "^16.2.14",
"@types/lodash": "^4.14.191",
Expand Down Expand Up @@ -372,8 +371,10 @@
"@types/webpack-node-externals": "^2.5.3",
"@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1",
"@types/ws": "^8.5.4",
"adr": "^1.4.3",
"ansi_up": "^5.1.0",
"canvas": "^2.10.1",
"chalk": "^4.1.2",
"chart.js": "^2.9.4",
"circular-dependency-plugin": "^5.2.2",
Expand Down Expand Up @@ -403,8 +404,8 @@
"ignore-loader": "^0.1.2",
"include-media": "^1.4.9",
"jest": "^28.1.3",
"jest-canvas-mock": "^2.3.1",
"jest-environment-jsdom": "^28.1.3",
"jest-image-snapshot": "^5.2.0",
"jest-mock-extended": "^2.0.9",
"make-plural": "^6.2.2",
"memfs": "^3.4.12",
Expand Down Expand Up @@ -447,28 +448,16 @@
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.11.1",
"webpack-node-externals": "^3.0.0",
"xterm": "^4.19.0",
"xterm-addon-fit": "^0.5.0"
"xterm": "^5.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit removes the last usage for earlier introduce image-snapshot dependency. Could you remove it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure also

"xterm-addon-fit": "^0.6.0",
"xterm-addon-search": "^0.10.0",
"xterm-addon-web-links": "^0.7.0",
"xterm-addon-webgl": "^0.13.0",
"xterm-link-provider": "^1.3.1"
},
"peerDependencies": {
"@types/byline": "^4.2.33",
"@types/chart.js": "^2.9.36",
"@types/color": "^3.0.3",
"@types/crypto-js": "^3.1.47",
"@types/lodash": "^4.14.191",
"@types/proper-lockfile": "^4.1.2",
"@types/react-dom": "^17.0.16",
"@types/react-router-dom": "^5.3.3",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/request-promise-native": "^1.0.18",
"@types/tar": "^6.1.3",
"@types/tcp-port-used": "^1.0.1",
"@types/url-parse": "^1.4.8",
"@types/uuid": "^8.3.4",
"monaco-editor": "^0.29.1",
"react-select": "^5.7.0",
"typed-emitter": "^1.4.0",
"xterm-addon-fit": "^0.5.0"
"typed-emitter": "^1.4.0"
}
}
2 changes: 1 addition & 1 deletion src/common/app-paths/app-paths-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { AppPaths } from "./app-path-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel";

export type AppPathsChannel = RequestChannel<void, AppPaths>;

Expand Down
4 changes: 4 additions & 0 deletions src/common/app-paths/app-paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ describe("app-paths", () => {
});
});

afterEach(() => {
builder.quit();
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this implies that there is some shared global state in the builder. We need to figure out what that is and remove it. There shouldn't be any requirement for cleanups after test.

describe("normally", () => {
let windowDi: DiContainer;
let mainDi: DiContainer;
Expand Down
11 changes: 11 additions & 0 deletions src/common/fs/change-path-mode.global-override-for-injectable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/

import { getGlobalOverride } from "../test-utils/get-global-override";
import changePathModeInjectable from "./change-path-mode.injectable";

export default getGlobalOverride(changePathModeInjectable, () => () => {
throw new Error("tried to change path mode without override");
});
16 changes: 16 additions & 0 deletions src/common/fs/change-path-mode.injectable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/

import { getInjectable } from "@ogre-tools/injectable";
import fsInjectable from "./fs.injectable";

export type ChangePathMode = (path: string, newMode: number) => Promise<void>;

const changePathModeInjectable = getInjectable({
id: "change-path-mode",
instantiate: (di): ChangePathMode => di.inject(fsInjectable).chmod,
});

export default changePathModeInjectable;
11 changes: 11 additions & 0 deletions src/common/fs/copy-file.global-override-for-injectable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/

import { getGlobalOverride } from "../test-utils/get-global-override";
import copyFileInjectable from "./copy-file.injectable";

export default getGlobalOverride(copyFileInjectable, () => () => {
throw new Error("tried to copy a file without override");
});
15 changes: 15 additions & 0 deletions src/common/fs/copy-file.injectable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import fsInjectable from "./fs.injectable";

export type CopyFile = (fromPath: string, toPath: string) => Promise<void>;

const copyFileInjectable = getInjectable({
id: "copy-file",
instantiate: (di): CopyFile => di.inject(fsInjectable).copyFile,
});

export default copyFileInjectable;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/

import { getGlobalOverride } from "../test-utils/get-global-override";
import createReadFileStreamInjectable from "./create-read-file-stream.injectable";

export default getGlobalOverride(createReadFileStreamInjectable, () => () => {
throw new Error("tried to create read stream for a file without override");
});
17 changes: 17 additions & 0 deletions src/common/fs/create-write-file-stream.injectable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/

import { getInjectable } from "@ogre-tools/injectable";
import type { createWriteStream } from "fs";
import fsInjectable from "./fs.injectable";

export type CreateWriteFileStream = typeof createWriteStream;

const createWriteFileStreamInjectable = getInjectable({
id: "create-write-file-stream",
instantiate: (di) => di.inject(fsInjectable).createWriteStream,
});

export default createWriteFileStreamInjectable;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/

import { getGlobalOverride } from "../test-utils/get-global-override";
import createWriteFileStreamInjectable from "./create-write-file-stream.injectable";

export default getGlobalOverride(createWriteFileStreamInjectable, () => () => {
throw new Error("tried to create a file write stream without override");
});
11 changes: 11 additions & 0 deletions src/common/fs/ensure-directory.global-override-for-injectable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/

import { getGlobalOverride } from "../test-utils/get-global-override";
import ensureDirectoryInjectable from "./ensure-directory.injectable";

export default getGlobalOverride(ensureDirectoryInjectable, () => async () => {
throw new Error("tried to ensure directory without override");
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import type { EnsureOptions } from "fs-extra";
import fsInjectable from "./fs.injectable";

export type EnsureDirectory = (dirPath: string) => Promise<void>;
export type EnsureDirectory = (dirPath: string, options?: number | EnsureOptions) => Promise<void>;

const ensureDirInjectable = getInjectable({
const ensureDirectoryInjectable = getInjectable({
id: "ensure-dir",

// TODO: Remove usages of ensureDir from business logic.
// TODO: Read, Write, Watch etc. operations should do this internally.
instantiate: (di): EnsureDirectory => di.inject(fsInjectable).ensureDir,
});

export default ensureDirInjectable;
export default ensureDirectoryInjectable;
2 changes: 1 addition & 1 deletion src/common/helm/add-helm-repository-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import type { HelmRepo } from "./helm-repo";
import type { AsyncResult } from "../utils/async-result";
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel";

export type AddHelmRepositoryChannel = RequestChannel<HelmRepo, AsyncResult<void, string>>;

Expand Down
2 changes: 1 addition & 1 deletion src/common/helm/get-active-helm-repositories-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import type { HelmRepo } from "./helm-repo";
import type { AsyncResult } from "../utils/async-result";
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel";

export type GetActiveHelmRepositoriesChannel = RequestChannel<void, AsyncResult<HelmRepo[]>>;

Expand Down
2 changes: 1 addition & 1 deletion src/common/helm/remove-helm-repository-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { AsyncResult } from "../utils/async-result";
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel";
import type { HelmRepo } from "./helm-repo";

export type RemoveHelmRepositoryChannel = RequestChannel<HelmRepo, AsyncResult<void, string>>;
Expand Down
10 changes: 5 additions & 5 deletions src/common/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@


export interface Logger {
info: (message: string, ...args: any) => void;
error: (message: string, ...args: any) => void;
debug: (message: string, ...args: any) => void;
warn: (message: string, ...args: any) => void;
silly: (message: string, ...args: any) => void;
info: (message: string, ...args: any[]) => void;
error: (message: string, ...args: any[]) => void;
debug: (message: string, ...args: any[]) => void;
warn: (message: string, ...args: any[]) => void;
silly: (message: string, ...args: any[]) => void;
}
10 changes: 10 additions & 0 deletions src/common/path/delimiter.global-override-for-injectable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/

import path from "path";
import { getGlobalOverride } from "../test-utils/get-global-override";
import pathDelimiterInjectable from "./delimiter.injectable";

export default getGlobalOverride(pathDelimiterInjectable, () => path.posix.delimiter);
14 changes: 14 additions & 0 deletions src/common/path/delimiter.injectable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import path from "path";

const pathDelimiterInjectable = getInjectable({
id: "path-delimiter",
instantiate: () => path.delimiter,
causesSideEffects: true,
});

export default pathDelimiterInjectable;
4 changes: 4 additions & 0 deletions src/common/terminal/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum TerminalChannels {
CONNECTED = "connected",
RESIZE = "resize",
PING = "ping",
ERROR = "error",
}

export type TerminalMessage = {
Expand All @@ -28,4 +29,7 @@ export type TerminalMessage = {
};
} | {
type: TerminalChannels.PING;
} | {
type: TerminalChannels.ERROR;
data: string;
};
4 changes: 4 additions & 0 deletions src/common/utils/async-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ export type AsyncResult<Response, Error = string> =
: { callWasSuccessful: true; response: Response }
)
| { callWasSuccessful: false; error: Error };

export type Result<Response, Error = string> =
| { callWasSuccessful: true; response: Response }
| { callWasSuccessful: false; error: Error };
Loading