Skip to content

Commit 6af1fe5

Browse files
committed
Use correct Mocha TDD functions
The `before` and `after` etc. are for BDD (e.g. `describe` and `it`), but we're using TDD (e.g. `suite` and `test`). I think they're just aliases of each other, but let's be correct.
1 parent 380029a commit 6af1fe5

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

test/core/paths.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import * as assert from "assert";
55
import * as fs from "fs";
66
import * as path from "path";
77
import * as vscode from "vscode";
8-
import { before } from "mocha";
8+
import { suiteSetup } from "mocha";
99
import utils = require("../utils");
1010

1111
suite("Path assumptions", () => {
12-
before(async () => { await utils.ensureExtensionIsActivated(); });
12+
suiteSetup(utils.ensureExtensionIsActivated);
1313

1414
test("The examples folder can be opened (and exists)", async () => {
1515
assert(await vscode.commands.executeCommand("PowerShell.OpenExamplesFolder"));

test/features/ExternalApi.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// Licensed under the MIT License.
33

44
import * as assert from "assert";
5-
import { before, beforeEach, afterEach } from "mocha";
5+
import { suiteSetup, setup, teardown } from "mocha";
66
import utils = require("../utils");
77
import { IExternalPowerShellDetails, IPowerShellExtensionClient } from "../../src/features/ExternalApi";
88

99
suite("ExternalApi feature - Registration API", () => {
1010
let powerShellExtensionClient: IPowerShellExtensionClient;
11-
before(async () => {
11+
suiteSetup(async () => {
1212
const powershellExtension = await utils.ensureExtensionIsActivated();
1313
powerShellExtensionClient = powershellExtension!.exports as IPowerShellExtensionClient;
1414
});
@@ -65,16 +65,16 @@ suite("ExternalApi feature - Other APIs", () => {
6565
let sessionId: string;
6666
let powerShellExtensionClient: IPowerShellExtensionClient;
6767

68-
before(async () => {
68+
suiteSetup(async () => {
6969
const powershellExtension = await utils.ensureExtensionIsActivated();
7070
powerShellExtensionClient = powershellExtension!.exports as IPowerShellExtensionClient;
7171
});
7272

73-
beforeEach(() => {
73+
setup(() => {
7474
sessionId = powerShellExtensionClient.registerExternalExtension(utils.extensionId);
7575
});
7676

77-
afterEach(() => {
77+
teardown(() => {
7878
powerShellExtensionClient.unregisterExternalExtension(sessionId);
7979
});
8080

test/features/ISECompatibility.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
import * as assert from "assert";
55
import * as vscode from "vscode";
6-
import { before } from "mocha";
6+
import { suiteSetup } from "mocha";
77
import { ISECompatibilityFeature } from "../../src/features/ISECompatibility";
88
import utils = require("../utils");
99

1010
suite("ISECompatibility feature", () => {
11-
before(async () => { await utils.ensureExtensionIsActivated(); } );
11+
suiteSetup(utils.ensureExtensionIsActivated);
1212

1313
test("It sets ISE Settings", async () => {
1414
await vscode.commands.executeCommand("PowerShell.EnableISEMode");

test/features/RunCode.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import * as assert from "assert";
55
import * as fs from "fs";
66
import * as path from "path";
7-
import { before } from "mocha";
7+
import { suiteSetup } from "mocha";
88
import rewire = require("rewire");
99
import vscode = require("vscode");
1010
import utils = require("../utils");
@@ -19,7 +19,7 @@ enum LaunchType {
1919
}
2020

2121
suite("RunCode tests", () => {
22-
before(async () => { await utils.ensureExtensionIsActivated(); } );
22+
suiteSetup(utils.ensureExtensionIsActivated);
2323

2424
test("Can create the launch config", () => {
2525
const commandToRun: string = "Invoke-Build";

0 commit comments

Comments
 (0)