Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2b3a8d5

Browse files
committedMay 15, 2025·
WIP: Switching to vscode-cli
1 parent c41078f commit 2b3a8d5

21 files changed

+865
-464
lines changed
 

‎.mocharc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"require": "tsx",
2+
"require": "esbuild-register",
33
"color": true,
44
"enable-source-maps": true,
55
"timeout": 600000,

‎.vscode-test.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os from "os";
2+
import path from "path";
3+
import { defineConfig } from "@vscode/test-cli";
4+
5+
export default defineConfig({
6+
files: "test/**/*.test.ts",
7+
// The default user data directory had too many characters for the IPC connection on macOS in CI.
8+
launchArgs: [ "--profile-temp", "--user-data-dir", path.join(os.tmpdir(), "vscode-user-data") ],
9+
workspaceFolder: "test/TestEnvironment.code-workspace",
10+
mocha: {
11+
ui: "bdd", // describe, it, etc.
12+
require: "esbuild-register",
13+
timeout: 60 * 1000 // 10 minutes to allow for debugging
14+
},
15+
});

‎package-lock.json

Lines changed: 706 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,18 @@
7878
"@types/mock-fs": "^4.13.4",
7979
"@types/node": "^20.17.47",
8080
"@types/node-fetch": "^2.6.12",
81-
"@types/rewire": "^2.5.30",
8281
"@types/semver": "^7.7.0",
8382
"@types/sinon": "^17.0.4",
8483
"@types/ungap__structured-clone": "^1.2.0",
8584
"@types/uuid": "^9.0.8",
8685
"@types/vscode": "~1.96.0",
8786
"@ungap/structured-clone": "^1.3.0",
8887
"@vscode/debugprotocol": "^1.68.0",
88+
"@vscode/test-cli": "^0.0.10",
8989
"@vscode/test-electron": "^2.5.2",
90+
"esbuild-register": "^3.6.0",
9091
"eslint": "^9.26.0",
9192
"eslint-config-prettier": "^10.1.5",
92-
"glob": "^11.0.2",
9393
"mocha": "^11.2.2",
9494
"mocha-explorer-launcher-scripts": "^0.4.0",
9595
"mocha-multi-reporters": "^1.5.1",
@@ -98,7 +98,6 @@
9898
"prettier-plugin-organize-imports": "^4.1.0",
9999
"sinon": "^19.0.5",
100100
"source-map-support": "^0.5.21",
101-
"tsx": "^4.19.4",
102101
"typescript": "^5.8.3",
103102
"typescript-eslint": "^8.32.1"
104103
},
@@ -112,9 +111,8 @@
112111
"lint": "eslint src test --ext .ts",
113112
"package": "vsce package --out out/ --no-gitHubIssueLinking",
114113
"publish": "vsce publish",
115-
"compile-test": "esbuild ./test/runTestsInner.ts --outdir=dist --bundle --external:vscode --platform=node",
116-
"pretest": "npm run compile && npm run compile-test",
117-
"test": "tsx ./test/runTests.ts"
114+
"pretest": "npm run compile",
115+
"test": "vscode-test"
118116
},
119117
"contributes": {
120118
"breakpoints": [

‎src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<IPower
8282
// e.g. /** | */
8383
// eslint-disable-next-line no-useless-escape
8484
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
85-
// eslint-disable-next-line no-useless-escape
85+
8686
afterText: /^\s*\*\/$/,
8787
action: { indentAction: vscode.IndentAction.IndentOutdent, appendText: " * " },
8888
},
@@ -201,7 +201,7 @@ function registerWaitForPsesActivationCommand(context: vscode.ExtensionContext):
201201
const pidFile = vscode.Uri.joinPath(context.globalStorageUri, "sessions", pidFileName);
202202
const fs = vscode.workspace.fs;
203203
// Wait for the file to be created
204-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-constant-condition
204+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
205205
while (true) {
206206
try {
207207
const pidContent = await fs.readFile(pidFile);

‎src/features/DebugSession.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ interface IProcessItem extends QuickPickItem {
703703
processId: number; // payload for the QuickPick UI
704704
}
705705

706-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
706+
707707
interface IGetPSHostProcessesArguments {
708708
}
709709

@@ -722,7 +722,7 @@ interface IRunspaceItem extends QuickPickItem {
722722
id: number; // payload for the QuickPick UI
723723
}
724724

725-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
725+
726726
interface IGetRunspaceRequestArguments {
727727
}
728728

‎src/features/ExpandAlias.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import { RequestType } from "vscode-languageclient";
66
import { LanguageClientConsumer } from "../languageClientConsumer";
77
import type { LanguageClient } from "vscode-languageclient/node";
88

9-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
9+
1010
interface IExpandAliasRequestArguments {
1111
}
1212

13-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
13+
1414
interface IExpandAliasRequestResponse {
1515
text: string
1616
}
@@ -52,7 +52,7 @@ export class ExpandAliasFeature extends LanguageClientConsumer {
5252
});
5353
}
5454

55-
// eslint-disable-next-line @typescript-eslint/no-empty-function
55+
5656
public override onLanguageClientSet(_languageClient: LanguageClient): void {}
5757

5858
public dispose(): void {

‎src/features/ExtensionCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const GetEditorContextRequestType =
6464
new RequestType<IGetEditorContextRequestArguments, IEditorContext, void>(
6565
"editor/getEditorContext");
6666

67-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
67+
6868
export interface IGetEditorContextRequestArguments {
6969
}
7070

‎src/features/HelpCompletion.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { LanguageClient } from "vscode-languageclient/node";
1010
import { Settings, CommentType, getSettings } from "../settings";
1111
import { LanguageClientConsumer } from "../languageClientConsumer";
1212

13-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
13+
1414
interface ICommentHelpRequestArguments {
1515
}
1616

17-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
17+
1818
interface ICommentHelpRequestResponse {
1919
content: string[]
2020
}
@@ -88,7 +88,7 @@ class TriggerFinder {
8888
public updateState(document: TextDocument, changeText: string): void {
8989
switch (this.state) {
9090
case SearchState.Searching:
91-
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
91+
9292
if (changeText.length === 1 && changeText[0] === this.triggerCharacters[this.count]) {
9393
this.state = SearchState.Locked;
9494
this.document = document;
@@ -97,7 +97,7 @@ class TriggerFinder {
9797
break;
9898

9999
case SearchState.Locked:
100-
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
100+
101101
if (document === this.document && changeText.length === 1 && changeText[0] === this.triggerCharacters[this.count]) {
102102
this.count++;
103103
if (this.count === this.triggerCharacters.length) {
@@ -136,7 +136,7 @@ class HelpCompletionProvider extends LanguageClientConsumer {
136136
return this.triggerFinderHelpComment.found;
137137
}
138138

139-
// eslint-disable-next-line @typescript-eslint/no-empty-function
139+
140140
public override onLanguageClientSet(_languageClient: LanguageClient): void {}
141141

142142
public updateState(document: TextDocument, changeText: string, changeRange: Range): void {

‎src/features/PesterTests.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import * as path from "path";
55
import vscode = require("vscode");
6-
import { ILogger } from "../logging";
6+
import type { ILogger } from "../logging";
77
import { SessionManager } from "../session";
88
import { getSettings, getChosenWorkspace } from "../settings";
99
import utils = require("../utils");
@@ -53,9 +53,7 @@ export class PesterTestsFeature implements vscode.Disposable {
5353
launchType: LaunchType,
5454
fileUri?: vscode.Uri): Promise<boolean> {
5555

56-
if (fileUri === undefined) {
57-
fileUri = vscode.window.activeTextEditor?.document.uri;
58-
}
56+
fileUri ??= vscode.window.activeTextEditor?.document.uri;
5957

6058
if (fileUri === undefined) {
6159
return false;

‎src/features/RemoteFiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class RemoteFilesFeature extends LanguageClientConsumer {
4949
});
5050
}
5151

52-
// eslint-disable-next-line @typescript-eslint/no-empty-function
52+
5353
public override onLanguageClientSet(_languageClient: LanguageClient): void {}
5454

5555
public dispose(): void {

‎src/features/ShowHelp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { NotificationType } from "vscode-languageclient";
66
import { LanguageClientConsumer } from "../languageClientConsumer";
77
import type { LanguageClient } from "vscode-languageclient/node";
88

9-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
9+
1010
interface IShowHelpNotificationArguments {
1111
}
1212

@@ -40,7 +40,7 @@ export class ShowHelpFeature extends LanguageClientConsumer {
4040
});
4141
}
4242

43-
// eslint-disable-next-line @typescript-eslint/no-empty-function
43+
4444
public override onLanguageClientSet(_languageClient: LanguageClient): void {}
4545

4646
public dispose(): void {

‎src/logging.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
import { LogOutputChannel, LogLevel, window, Event } from "vscode";
4+
import { type LogOutputChannel, LogLevel, window, type Event } from "vscode";
55

66
/** Interface for logging operations. New features should use this interface for the "type" of logger.
77
* This will allow for easy mocking of the logger during unit tests.
@@ -140,9 +140,7 @@ export class Logger implements ILogger {
140140
export class LanguageClientOutputChannelAdapter implements LogOutputChannel {
141141
private _channel: LogOutputChannel | undefined;
142142
private get channel(): LogOutputChannel {
143-
if (!this._channel) {
144-
this._channel = window.createOutputChannel(this.channelName, {log: true});
145-
}
143+
this._channel ??= window.createOutputChannel(this.channelName, {log: true});
146144
return this._channel;
147145
}
148146

‎src/platform.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ import * as path from "path";
66
import * as process from "process";
77
import vscode = require("vscode");
88
import { integer } from "vscode-languageserver-protocol";
9-
import { ILogger } from "./logging";
10-
import { changeSetting, getSettings, PowerShellAdditionalExePathSettings } from "./settings";
9+
import type { ILogger } from "./logging";
10+
import { changeSetting, getSettings, type PowerShellAdditionalExePathSettings } from "./settings";
1111
import untildify from "untildify";
1212

1313
// This uses require so we can rewire it in unit tests!
14-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-var-requires
1514
const utils = require("./utils");
1615

1716
const WindowsPowerShell64BitLabel = "Windows PowerShell (x64)";
@@ -157,7 +156,7 @@ export class PowerShellExeFinder {
157156
yield additionalPwsh;
158157
} else if (!additionalPwsh.suppressWarning) {
159158
const message = `Additional PowerShell '${additionalPwsh.displayName}' not found at '${additionalPwsh.exePath}'!`;
160-
this.logger.writeWarning(message);
159+
this.logger?.writeWarning(message);
161160

162161
if (!getSettings().suppressAdditionalExeNotFoundWarning) {
163162
const selection = await vscode.window.showWarningMessage(message, "Don't Show Again");
@@ -631,9 +630,7 @@ class PossiblePowerShellExe implements IPossiblePowerShellExe {
631630
public readonly suppressWarning = false) { }
632631

633632
public async exists(): Promise<boolean> {
634-
if (this.knownToExist === undefined) {
635-
this.knownToExist = await utils.checkIfFileExists(this.exePath);
636-
}
633+
this.knownToExist ??= await utils.checkIfFileExists(this.exePath);
637634
return this.knownToExist ?? false;
638635
}
639636
}

‎src/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ class SessionMenuItem implements vscode.QuickPickItem {
10671067

10681068
constructor(
10691069
public readonly label: string,
1070-
// eslint-disable-next-line @typescript-eslint/no-empty-function
1070+
10711071
public readonly callback = async (): Promise<void> => { }) {
10721072
}
10731073
}

‎test/core/platform.test.ts

Lines changed: 111 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,33 @@ import * as os from "os";
88
import * as path from "path";
99
import * as sinon from "sinon";
1010
import * as platform from "../../src/platform";
11+
import * as utils from "../../src/utils";
1112
import * as fs from "fs"; // NOTE: Necessary for mock-fs.
1213
import * as vscode from "vscode";
13-
import * as utils from "../../src/utils";
1414

1515
// eslint-disable-next-line @typescript-eslint/require-await
16-
async function fakeCheckIfFileExists(
17-
targetPath: string | vscode.Uri,
18-
): Promise<boolean> {
19-
try {
20-
const stat = fs.lstatSync(
21-
targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath,
22-
);
23-
return stat.isFile();
24-
} catch {
25-
return false;
26-
}
16+
async function fakeCheckIfFileExists(targetPath: string | vscode.Uri): Promise<boolean> {
17+
try {
18+
const stat = fs.lstatSync(targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath);
19+
return stat.isFile();
20+
} catch {
21+
return false;
22+
}
2723
}
2824

2925
// eslint-disable-next-line @typescript-eslint/require-await
30-
async function fakeCheckIfDirectoryExists(
31-
targetPath: string | vscode.Uri,
32-
): Promise<boolean> {
33-
try {
34-
const stat = fs.lstatSync(
35-
targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath,
36-
);
37-
return stat.isDirectory();
38-
} catch {
39-
return false;
40-
}
26+
async function fakeCheckIfDirectoryExists(targetPath: string | vscode.Uri): Promise<boolean> {
27+
try {
28+
const stat = fs.lstatSync(targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath);
29+
return stat.isDirectory();
30+
} catch {
31+
return false;
32+
}
4133
}
4234

4335
// eslint-disable-next-line @typescript-eslint/require-await
44-
async function fakeReadDirectory(
45-
targetPath: string | vscode.Uri,
46-
): Promise<string[]> {
47-
return fs.readdirSync(
48-
targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath,
49-
);
36+
async function fakeReadDirectory(targetPath: string | vscode.Uri): Promise<string[]> {
37+
return fs.readdirSync(targetPath instanceof vscode.Uri ? targetPath.fsPath : targetPath);
5038
}
5139

5240
/**
@@ -845,22 +833,22 @@ function setupTestEnvironment(testPlatform: ITestPlatform): void {
845833
}
846834

847835
describe("Platform module", function () {
848-
beforeEach(function () {
836+
before(function () {
849837
sinon.stub(utils, "checkIfFileExists").callsFake(fakeCheckIfFileExists);
850-
sinon
851-
.stub(utils, "checkIfDirectoryExists")
852-
.callsFake(fakeCheckIfDirectoryExists);
838+
sinon.stub(utils, "checkIfDirectoryExists").callsFake(fakeCheckIfDirectoryExists);
853839
sinon.stub(utils, "readDirectory").callsFake(fakeReadDirectory);
854840
});
855841

856-
afterEach(function () {
842+
after(function () {
857843
sinon.restore();
844+
})
845+
846+
afterEach(function () {
858847
mockFS.restore();
859848
});
860849

861850
it("Gets the correct platform details", function () {
862-
const platformDetails: platform.IPlatformDetails =
863-
platform.getPlatformDetails();
851+
const platformDetails: platform.IPlatformDetails = platform.getPlatformDetails();
864852
switch (process.platform) {
865853
case "darwin":
866854
assert.strictEqual(
@@ -913,181 +901,124 @@ describe("Platform module", function () {
913901
});
914902

915903
describe("Default PowerShell installation", function () {
916-
for (const testPlatform of successTestCases) {
917-
it(`Finds it on ${testPlatform.name}`, async function () {
918-
setupTestEnvironment(testPlatform);
904+
for (const testPlatform of successTestCases) {
905+
it(`Finds it on ${testPlatform.name}`, async function () {
906+
setupTestEnvironment(testPlatform);
919907

920-
const powerShellExeFinder = new platform.PowerShellExeFinder(
921-
testPlatform.platformDetails, {}
922-
);
908+
const powerShellExeFinder = new platform.PowerShellExeFinder(testPlatform.platformDetails, {});
923909

924-
const defaultPowerShell =
925-
await powerShellExeFinder.getFirstAvailablePowerShellInstallation();
926-
const expectedPowerShell = testPlatform.expectedPowerShellSequence[0];
910+
const defaultPowerShell = await powerShellExeFinder.getFirstAvailablePowerShellInstallation();
911+
const expectedPowerShell = testPlatform.expectedPowerShellSequence[0];
927912

928-
assert.strictEqual(
929-
defaultPowerShell!.exePath,
930-
expectedPowerShell.exePath,
931-
);
932-
assert.strictEqual(
933-
defaultPowerShell!.displayName,
934-
expectedPowerShell.displayName,
935-
);
936-
assert.strictEqual(
937-
defaultPowerShell!.supportsProperArguments,
938-
expectedPowerShell.supportsProperArguments,
939-
);
940-
});
941-
}
913+
assert.strictEqual(defaultPowerShell!.exePath, expectedPowerShell.exePath);
914+
assert.strictEqual(defaultPowerShell!.displayName, expectedPowerShell.displayName);
915+
assert.strictEqual(defaultPowerShell!.supportsProperArguments, expectedPowerShell.supportsProperArguments);
916+
});
917+
}
942918

943-
for (const testPlatform of errorTestCases) {
944-
it(`Fails gracefully on ${testPlatform.name}`, async function () {
945-
setupTestEnvironment(testPlatform);
919+
for (const testPlatform of errorTestCases) {
920+
it(`Fails gracefully on ${testPlatform.name}`, async function () {
921+
setupTestEnvironment(testPlatform);
946922

947-
const powerShellExeFinder = new platform.PowerShellExeFinder(
948-
testPlatform.platformDetails, {}
949-
);
923+
const powerShellExeFinder = new platform.PowerShellExeFinder(testPlatform.platformDetails, {});
950924

951-
const defaultPowerShell =
952-
await powerShellExeFinder.getFirstAvailablePowerShellInstallation();
953-
assert.strictEqual(defaultPowerShell, undefined);
954-
});
955-
}
925+
const defaultPowerShell = await powerShellExeFinder.getFirstAvailablePowerShellInstallation();
926+
assert.strictEqual(defaultPowerShell, undefined);
927+
});
928+
}
956929
});
957930

958931
describe("Expected PowerShell installation list", function () {
959-
for (const testPlatform of successTestCases) {
960-
it(`Finds them on ${testPlatform.name}`, async function () {
961-
setupTestEnvironment(testPlatform);
932+
for (const testPlatform of successTestCases) {
933+
it(`Finds them on ${testPlatform.name}`, async function () {
934+
setupTestEnvironment(testPlatform);
962935

963-
const powerShellExeFinder = new platform.PowerShellExeFinder(
964-
testPlatform.platformDetails, {}
965-
);
936+
const powerShellExeFinder = new platform.PowerShellExeFinder(testPlatform.platformDetails, {});
966937

967-
const foundPowerShells =
968-
await powerShellExeFinder.getAllAvailablePowerShellInstallations();
938+
const foundPowerShells = await powerShellExeFinder.getAllAvailablePowerShellInstallations();
969939

970-
for (
971-
let i = 0;
972-
i < testPlatform.expectedPowerShellSequence.length;
973-
i++
974-
) {
975-
const foundPowerShell = foundPowerShells[i];
976-
const expectedPowerShell =
977-
testPlatform.expectedPowerShellSequence[i];
940+
for (let i = 0; i < testPlatform.expectedPowerShellSequence.length; i++) {
941+
const foundPowerShell = foundPowerShells[i];
942+
const expectedPowerShell = testPlatform.expectedPowerShellSequence[i];
978943

979-
assert.strictEqual(
980-
foundPowerShell.exePath,
981-
expectedPowerShell.exePath,
982-
);
983-
assert.strictEqual(
984-
foundPowerShell.displayName,
985-
expectedPowerShell.displayName,
986-
);
987-
assert.strictEqual(
988-
foundPowerShell.supportsProperArguments,
989-
expectedPowerShell.supportsProperArguments,
990-
);
991-
}
944+
assert.strictEqual(foundPowerShell.exePath, expectedPowerShell.exePath);
945+
assert.strictEqual(foundPowerShell.displayName, expectedPowerShell.displayName);
946+
assert.strictEqual(foundPowerShell.supportsProperArguments, expectedPowerShell.supportsProperArguments);
947+
}
992948

993-
assert.strictEqual(
994-
foundPowerShells.length,
995-
testPlatform.expectedPowerShellSequence.length,
996-
"Number of expected PowerShells found does not match",
997-
);
998-
});
999-
}
949+
assert.strictEqual(
950+
foundPowerShells.length,
951+
testPlatform.expectedPowerShellSequence.length,
952+
"Number of expected PowerShells found does not match");
953+
});
954+
}
1000955

1001-
for (const testPlatform of errorTestCases) {
1002-
it(`Fails gracefully on ${testPlatform.name}`, async function () {
1003-
setupTestEnvironment(testPlatform);
956+
for (const testPlatform of errorTestCases) {
957+
it(`Fails gracefully on ${testPlatform.name}`, async function () {
958+
setupTestEnvironment(testPlatform);
1004959

1005-
const powerShellExeFinder = new platform.PowerShellExeFinder(
1006-
testPlatform.platformDetails, {}
1007-
);
960+
const powerShellExeFinder = new platform.PowerShellExeFinder(testPlatform.platformDetails, {});
1008961

1009-
const foundPowerShells =
1010-
await powerShellExeFinder.getAllAvailablePowerShellInstallations();
1011-
assert.strictEqual(foundPowerShells.length, 0);
1012-
});
1013-
}
962+
const foundPowerShells = await powerShellExeFinder.getAllAvailablePowerShellInstallations();
963+
assert.strictEqual(foundPowerShells.length, 0);
964+
});
965+
}
1014966
});
1015967

1016968
describe("Windows PowerShell path fix", function () {
1017-
for (const testPlatform of successTestCases.filter(
1018-
(tp) =>
1019-
tp.platformDetails.operatingSystem ===
1020-
platform.OperatingSystem.Windows,
1021-
)) {
1022-
it(`Corrects the Windows PowerShell path on ${testPlatform.name}`, function () {
1023-
setupTestEnvironment(testPlatform);
969+
for (const testPlatform of successTestCases
970+
.filter((tp) => tp.platformDetails.operatingSystem === platform.OperatingSystem.Windows)) {
971+
972+
it(`Corrects the Windows PowerShell path on ${testPlatform.name}`, function () {
973+
setupTestEnvironment(testPlatform);
1024974

1025-
function getWinPSPath(systemDir: string): string {
1026-
return path.join(
1027-
testPlatform.environmentVars.windir,
1028-
systemDir,
1029-
"WindowsPowerShell",
1030-
"v1.0",
1031-
"powershell.exe",
1032-
);
1033-
}
975+
function getWinPSPath(systemDir: string): string {
976+
return path.join(
977+
testPlatform.environmentVars.windir,
978+
systemDir,
979+
"WindowsPowerShell",
980+
"v1.0",
981+
"powershell.exe");
982+
}
1034983

1035-
const winPSPath = getWinPSPath("System32");
984+
const winPSPath = getWinPSPath("System32");
1036985

1037-
let altWinPSPath;
1038-
if (testPlatform.platformDetails.isProcess64Bit) {
1039-
altWinPSPath = getWinPSPath("SysWOW64");
1040-
} else if (testPlatform.platformDetails.isOS64Bit) {
1041-
altWinPSPath = getWinPSPath("Sysnative");
1042-
} else {
1043-
altWinPSPath = null;
1044-
}
986+
let altWinPSPath;
987+
if (testPlatform.platformDetails.isProcess64Bit) {
988+
altWinPSPath = getWinPSPath("SysWOW64");
989+
} else if (testPlatform.platformDetails.isOS64Bit) {
990+
altWinPSPath = getWinPSPath("Sysnative");
991+
} else {
992+
altWinPSPath = null;
993+
}
1045994

1046-
const powerShellExeFinder = new platform.PowerShellExeFinder(
1047-
testPlatform.platformDetails, {}
1048-
);
995+
const powerShellExeFinder = new platform.PowerShellExeFinder(testPlatform.platformDetails, {});
1049996

1050-
assert.strictEqual(
1051-
powerShellExeFinder.fixWindowsPowerShellPath(winPSPath),
1052-
winPSPath,
1053-
);
997+
assert.strictEqual(powerShellExeFinder.fixWindowsPowerShellPath(winPSPath), winPSPath);
1054998

1055-
if (altWinPSPath) {
1056-
assert.strictEqual(
1057-
powerShellExeFinder.fixWindowsPowerShellPath(altWinPSPath),
1058-
winPSPath,
1059-
);
1060-
}
1061-
});
1062-
}
999+
if (altWinPSPath) {
1000+
assert.strictEqual(powerShellExeFinder.fixWindowsPowerShellPath(altWinPSPath), winPSPath);
1001+
}
1002+
});
1003+
}
10631004
});
10641005

10651006
describe("PowerShell executables from 'powerShellAdditionalExePaths' are found", function () {
1066-
for (const testPlatform of successAdditionalTestCases) {
1067-
it(`Guesses for ${testPlatform.name}`, async function () {
1068-
setupTestEnvironment(testPlatform);
1007+
for (const testPlatform of successAdditionalTestCases) {
1008+
it(`Guesses for ${testPlatform.name}`, async function () {
1009+
setupTestEnvironment(testPlatform);
10691010

1070-
const powerShellExeFinder = new platform.PowerShellExeFinder(
1071-
testPlatform.platformDetails,
1072-
additionalPowerShellExes,
1073-
);
1011+
const powerShellExeFinder = new platform.PowerShellExeFinder(testPlatform.platformDetails, additionalPowerShellExes);
10741012

1075-
let i = 0;
1076-
for await (const additionalPwsh of powerShellExeFinder.enumerateAdditionalPowerShellInstallations()) {
1077-
const expectedPowerShell =
1078-
testPlatform.expectedPowerShellSequence[i];
1079-
i++;
1013+
let i = 0;
1014+
for await (const additionalPwsh of powerShellExeFinder.enumerateAdditionalPowerShellInstallations()) {
1015+
const expectedPowerShell = testPlatform.expectedPowerShellSequence[i];
1016+
i++;
10801017

1081-
assert.strictEqual(
1082-
additionalPwsh.exePath,
1083-
expectedPowerShell.exePath,
1084-
);
1085-
assert.strictEqual(
1086-
additionalPwsh.displayName,
1087-
expectedPowerShell.displayName,
1088-
);
1089-
}
1090-
});
1091-
}
1018+
assert.strictEqual(additionalPwsh.exePath, expectedPowerShell.exePath);
1019+
assert.strictEqual(additionalPwsh.displayName, expectedPowerShell.displayName);
1020+
}
1021+
});
1022+
}
10921023
});
10931024
});

‎test/features/ExternalApi.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import * as assert from "assert";
55
import utils = require("../utils");
6-
import { IExternalPowerShellDetails, IPowerShellExtensionClient } from "../../src/features/ExternalApi";
6+
import type { IExternalPowerShellDetails, IPowerShellExtensionClient } from "../../src/features/ExternalApi";
77

88
describe("ExternalApi feature", function () {
99
describe("External extension registration", function () {

‎test/features/UpdatePowerShell.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import assert from "assert";
55
import { UpdatePowerShell } from "../../src/features/UpdatePowerShell";
66
import { Settings } from "../../src/settings";
7-
import { IPowerShellVersionDetails } from "../../src/session";
7+
import type { IPowerShellVersionDetails } from "../../src/session";
88
import { testLogger } from "../utils";
99

1010
describe("UpdatePowerShell feature", function () {

‎test/runTests.ts

Lines changed: 0 additions & 115 deletions
This file was deleted.

‎test/runTestsInner.ts

Lines changed: 0 additions & 72 deletions
This file was deleted.

‎test/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { execSync } from "child_process";
1010
// This lets us test the rest of our path assumptions against the baseline of
1111
// this test file existing at `<root>/test/utils.js`.
1212
export const rootPath = path.resolve(__dirname, "../");
13-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-var-requires
13+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1414
const packageJSON: any = require(path.resolve(rootPath, "package.json"));
1515
export const extensionId = `${packageJSON.publisher}.${packageJSON.name}`;
1616

0 commit comments

Comments
 (0)
Please sign in to comment.