Skip to content

Commit 27a422b

Browse files
committed
test
1 parent 2507845 commit 27a422b

File tree

3 files changed

+103
-95
lines changed

3 files changed

+103
-95
lines changed

.vscode-test.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { defineConfig } from '@vscode/test-cli';
2+
import * as path from 'path';
3+
import { fileURLToPath } from 'url';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = path.dirname(__filename);
27

38
export default defineConfig({
49
files: 'out/test/**/*.test.js',
10+
folderPath: path.resolve(__dirname),
511
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"watch-tests": "tsc -p . -w --outDir out",
9292
"pretest": "npm run compile-tests && npm run compile",
9393
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint src --ext ts",
94-
"test": "vscode-test .",
94+
"test": "vscode-test",
9595
"release": "release-it"
9696
},
9797
"dependencies": {

src/test/executable.test.ts

Lines changed: 96 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -82,105 +82,107 @@ class MockExtensionContext implements vscode.ExtensionContext {
8282
};
8383
}
8484

85-
suite("Executable Test Suite", () => {
86-
test("Download binary for macOS Intel (amd64)", async function () {
87-
this.timeout(30000);
88-
const context = new MockExtensionContext();
89-
const platformInfo = {
90-
platform: "darwin",
91-
arch: "amd64",
92-
extension: "",
93-
};
94-
const helmExecutable = await downloadHelmLs(context, platformInfo);
95-
assert.ok(helmExecutable);
96-
assert.ok(!helmExecutable.endsWith(".exe"));
97-
assert.ok(await fs.stat(helmExecutable));
98-
});
85+
if (process.env.CI) {
86+
suite("Executable Test Suite", () => {
87+
test("Download binary for macOS Intel (amd64)", async function () {
88+
this.timeout(30000);
89+
const context = new MockExtensionContext();
90+
const platformInfo = {
91+
platform: "darwin",
92+
arch: "amd64",
93+
extension: "",
94+
};
95+
const helmExecutable = await downloadHelmLs(context, platformInfo);
96+
assert.ok(helmExecutable);
97+
assert.ok(!helmExecutable.endsWith(".exe"));
98+
assert.ok(await fs.stat(helmExecutable));
99+
});
99100

100-
test("Download binary for macOS Apple Silicon (arm64)", async function () {
101-
this.timeout(30000);
102-
const context = new MockExtensionContext();
103-
const platformInfo = {
104-
platform: "darwin",
105-
arch: "arm64",
106-
extension: "",
107-
};
108-
const helmExecutable = await downloadHelmLs(context, platformInfo);
109-
assert.ok(helmExecutable);
110-
assert.ok(!helmExecutable.endsWith(".exe"));
111-
assert.ok(await fs.stat(helmExecutable));
112-
});
101+
test("Download binary for macOS Apple Silicon (arm64)", async function () {
102+
this.timeout(30000);
103+
const context = new MockExtensionContext();
104+
const platformInfo = {
105+
platform: "darwin",
106+
arch: "arm64",
107+
extension: "",
108+
};
109+
const helmExecutable = await downloadHelmLs(context, platformInfo);
110+
assert.ok(helmExecutable);
111+
assert.ok(!helmExecutable.endsWith(".exe"));
112+
assert.ok(await fs.stat(helmExecutable));
113+
});
113114

114-
test("Download binary for Linux amd64", async function () {
115-
this.timeout(30000);
116-
const context = new MockExtensionContext();
117-
const platformInfo = {
118-
platform: "linux",
119-
arch: "amd64",
120-
extension: "",
121-
};
122-
const helmExecutable = await downloadHelmLs(context, platformInfo);
123-
assert.ok(helmExecutable);
124-
assert.ok(!helmExecutable.endsWith(".exe"));
125-
assert.ok(await fs.stat(helmExecutable));
126-
});
115+
test("Download binary for Linux amd64", async function () {
116+
this.timeout(30000);
117+
const context = new MockExtensionContext();
118+
const platformInfo = {
119+
platform: "linux",
120+
arch: "amd64",
121+
extension: "",
122+
};
123+
const helmExecutable = await downloadHelmLs(context, platformInfo);
124+
assert.ok(helmExecutable);
125+
assert.ok(!helmExecutable.endsWith(".exe"));
126+
assert.ok(await fs.stat(helmExecutable));
127+
});
127128

128-
test("Download binary for Linux ARM (32-bit)", async function () {
129-
this.timeout(30000);
130-
const context = new MockExtensionContext();
131-
const platformInfo = {
132-
platform: "linux",
133-
arch: "arm",
134-
extension: "",
135-
};
136-
const helmExecutable = await downloadHelmLs(context, platformInfo);
137-
assert.ok(helmExecutable);
138-
assert.ok(!helmExecutable.endsWith(".exe"));
139-
assert.ok(await fs.stat(helmExecutable));
140-
});
129+
test("Download binary for Linux ARM (32-bit)", async function () {
130+
this.timeout(30000);
131+
const context = new MockExtensionContext();
132+
const platformInfo = {
133+
platform: "linux",
134+
arch: "arm",
135+
extension: "",
136+
};
137+
const helmExecutable = await downloadHelmLs(context, platformInfo);
138+
assert.ok(helmExecutable);
139+
assert.ok(!helmExecutable.endsWith(".exe"));
140+
assert.ok(await fs.stat(helmExecutable));
141+
});
141142

142-
test("Download binary for Linux ARM64", async function () {
143-
this.timeout(30000);
144-
const context = new MockExtensionContext();
145-
const platformInfo = {
146-
platform: "linux",
147-
arch: "arm64",
148-
extension: "",
149-
};
150-
const helmExecutable = await downloadHelmLs(context, platformInfo);
151-
assert.ok(helmExecutable);
152-
assert.ok(!helmExecutable.endsWith(".exe"));
153-
assert.ok(await fs.stat(helmExecutable));
154-
});
143+
test("Download binary for Linux ARM64", async function () {
144+
this.timeout(30000);
145+
const context = new MockExtensionContext();
146+
const platformInfo = {
147+
platform: "linux",
148+
arch: "arm64",
149+
extension: "",
150+
};
151+
const helmExecutable = await downloadHelmLs(context, platformInfo);
152+
assert.ok(helmExecutable);
153+
assert.ok(!helmExecutable.endsWith(".exe"));
154+
assert.ok(await fs.stat(helmExecutable));
155+
});
155156

156-
test("Download binary for Windows x64", async function () {
157-
this.timeout(30000);
158-
const context = new MockExtensionContext();
159-
const platformInfo = {
160-
platform: "windows",
161-
arch: "amd64",
162-
extension: ".exe",
163-
};
164-
const helmExecutable = await downloadHelmLs(context, platformInfo);
165-
assert.ok(helmExecutable);
166-
assert.ok(helmExecutable.endsWith(".exe"));
167-
assert.ok(await fs.stat(helmExecutable));
168-
});
157+
test("Download binary for Windows x64", async function () {
158+
this.timeout(30000);
159+
const context = new MockExtensionContext();
160+
const platformInfo = {
161+
platform: "windows",
162+
arch: "amd64",
163+
extension: ".exe",
164+
};
165+
const helmExecutable = await downloadHelmLs(context, platformInfo);
166+
assert.ok(helmExecutable);
167+
assert.ok(helmExecutable.endsWith(".exe"));
168+
assert.ok(await fs.stat(helmExecutable));
169+
});
169170

170-
test("Reuse downloaded binary", async function () {
171-
this.timeout(30000);
172-
const context = new MockExtensionContext();
173-
const platformInfo = {
174-
platform: "linux",
175-
arch: "amd64",
176-
extension: "",
177-
};
178-
// First download
179-
const helmExecutable1 = await downloadHelmLs(context, platformInfo);
180-
assert.ok(helmExecutable1);
171+
test("Reuse downloaded binary", async function () {
172+
this.timeout(30000);
173+
const context = new MockExtensionContext();
174+
const platformInfo = {
175+
platform: "linux",
176+
arch: "amd64",
177+
extension: "",
178+
};
179+
// First download
180+
const helmExecutable1 = await downloadHelmLs(context, platformInfo);
181+
assert.ok(helmExecutable1);
181182

182-
// Second attempt should reuse the same file
183-
const helmExecutable2 = await downloadHelmLs(context, platformInfo);
184-
assert.strictEqual(helmExecutable1, helmExecutable2);
183+
// Second attempt should reuse the same file
184+
const helmExecutable2 = await downloadHelmLs(context, platformInfo);
185+
assert.strictEqual(helmExecutable1, helmExecutable2);
186+
});
185187
});
186-
});
188+
}

0 commit comments

Comments
 (0)