1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
Sebastian Malton 2020-07-14 15:29:49 -04:00
parent 20ff8550df
commit a6bfd73de9
6 changed files with 18 additions and 10 deletions

View File

@ -13,7 +13,6 @@ describe("for an empty config", () => {
} }
} }
mockFs(mockOpts) mockFs(mockOpts)
const userStore = UserStore.getInstance()
}) })
afterEach(() => { afterEach(() => {
@ -57,12 +56,10 @@ describe("migrations", () => {
'config.json': JSON.stringify({ 'config.json': JSON.stringify({
user: { username: 'foobar' }, user: { username: 'foobar' },
preferences: { colorTheme: 'light' }, preferences: { colorTheme: 'light' },
lastSeenAppVersion: '1.2.3'
}) })
} }
} }
mockFs(mockOpts) mockFs(mockOpts)
const userStore = UserStore.getInstance()
}) })
afterEach(() => { afterEach(() => {

View File

@ -1,5 +1,4 @@
import { CoreV1Api, KubeConfig } from "@kubernetes/client-node" import { CoreV1Api, KubeConfig } from "@kubernetes/client-node"
import http from "http"
import { ServerOptions } from "http-proxy" import { ServerOptions } from "http-proxy"
import * as url from "url" import * as url from "url"
import logger from "./logger" import logger from "./logger"

View File

@ -125,7 +125,7 @@ export class Kubectl {
} }
try { try {
const { stdout, stderr } = await promiseExec(`"${this.path}" version --client=true -o json`) const { stdout } = await promiseExec(`"${this.path}" version --client=true -o json`)
const output = JSON.parse(stdout) const output = JSON.parse(stdout)
let version: string = output.clientVersion.gitVersion let version: string = output.clientVersion.gitVersion
if (version[0] === 'v') { if (version[0] === 'v') {

View File

@ -1,5 +1,4 @@
import { formatDuration } from "../formatDuration"; import { formatDuration } from "../formatDuration";
import { min } from "moment";
const second = 1000; const second = 1000;
const minute = 60 * second; const minute = 60 * second;
@ -44,4 +43,11 @@ describe("human format durations", () => {
const significant = formatDuration(31 * second, false); const significant = formatDuration(31 * second, false);
expect(significant).toBe("31s"); expect(significant).toBe("31s");
}); });
test("zero duration should output something", () => {
const zero = formatDuration(0, false);
expect(zero).not.toHaveLength(0);
expect(zero).toBe("0s");
});
}); });

View File

@ -24,7 +24,7 @@ export function formatDuration(timeValue: number, compact: boolean) {
.map(([dur, suf]) => dur + suf); .map(([dur, suf]) => dur + suf);
if (compact) { if (compact) {
return meaningfulValues[0]; return meaningfulValues[0] || "0s";
} }
return meaningfulValues.join(" "); return meaningfulValues.join(" ");

View File

@ -6,12 +6,11 @@
"target": "ES2017", "target": "ES2017",
"module": "ESNext", "module": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"], "lib": ["ESNext", "DOM", "DOM.Iterable"],
"importsNotUsedAsValues": "preserve",
"moduleResolution": "Node", "moduleResolution": "Node",
"sourceMap": true, "sourceMap": true,
"strict": false, "strict": false,
"noImplicitAny": true, "noImplicitAny": true,
"noUnusedLocals": false, "noUnusedLocals": true,
"noImplicitReturns": false, "noImplicitReturns": false,
"experimentalDecorators": true, "experimentalDecorators": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
@ -32,5 +31,12 @@
"compilerOptions": { "compilerOptions": {
"module": "CommonJS" "module": "CommonJS"
} }
} },
"exclude": [
"node_modules",
"dist",
"coverage",
"dashboard",
"binaries"
]
} }