diff --git a/.mocharc.json b/.mocharc.json index 5339fdd0c3..1aee445104 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -6,6 +6,7 @@ ".jsx" ], "require": "source-map-support/register", - "timeout": 10000, + "timeout": 30000, + "slow": 2000, "spec": "out/test/**/*.test.js" } diff --git a/test/core/settings.test.ts b/test/core/settings.test.ts index fcd1856a61..082f4cc626 100644 --- a/test/core/settings.test.ts +++ b/test/core/settings.test.ts @@ -6,7 +6,6 @@ import * as vscode from "vscode"; import { Settings, getSettings, getEffectiveConfigurationTarget, changeSetting, CommentType } from "../../src/settings"; describe("Settings E2E", function () { - this.slow(800); it("Loads without error", function () { assert.doesNotThrow(getSettings); }); diff --git a/test/features/CustomViews.test.ts b/test/features/CustomViews.test.ts index 00d9cd1382..88ccbc7b1a 100644 --- a/test/features/CustomViews.test.ts +++ b/test/features/CustomViews.test.ts @@ -30,7 +30,6 @@ function convertToVSCodeResourceScheme(filePath: string): string { } describe("CustomViews feature", function () { - this.slow(1500); const testCases: IHtmlContentViewTestCase[] = [ { name: "with no JavaScript or CSS", diff --git a/test/features/DebugSession.test.ts b/test/features/DebugSession.test.ts index b58013aef3..727d0971f7 100644 --- a/test/features/DebugSession.test.ts +++ b/test/features/DebugSession.test.ts @@ -429,10 +429,7 @@ describe("DebugSessionFeature", () => { }); }); -describe("DebugSessionFeature E2E", function slowTests() { - this.slow(20 * 1000); // Will warn if test takes longer than 10s and show red if longer than 20s - this.timeout(5 * 60 * 1000); // Give it five minutes, some CI is slow! - +describe("DebugSessionFeature E2E", () => { before(async () => { // Registers and warms up the debug adapter and the PowerShell Extension Terminal await ensureEditorServicesIsConnected(); @@ -440,31 +437,27 @@ describe("DebugSessionFeature E2E", function slowTests() { it("Starts and stops a debugging session", async () => { // Inspect the debug session via the started events to ensure it is correct - let startDebugSession: DebugSession; - let stopDebugSession: DebugSession; - const interactiveSessionConfig = defaultDebugConfigurations[DebugConfig.InteractiveSession]; - // Asserts don't seem to fire in this event or the event doesn't resolve - // in the test code flow, so we need to "extract" the values for later - // use by the asserts - - const startDebugEvent = debug.onDidStartDebugSession((newDebugSession) => { - startDebugEvent.dispose(); - startDebugSession = newDebugSession; - const stopDebugEvent = debug.onDidTerminateDebugSession((terminatedDebugSession) => { - stopDebugEvent.dispose(); - stopDebugSession = terminatedDebugSession; + const startDebugSession = new Promise((resolve) => { + const event = debug.onDidStartDebugSession((session) => { + resolve(session); + event.dispose(); + }); + }); + const stopDebugSession = new Promise((resolve) => { + const event = debug.onDidTerminateDebugSession((session) => { + resolve(session); + event.dispose(); }); }); - const debugSessionStarted = await debug.startDebugging(undefined, interactiveSessionConfig); - assert.ok(debugSessionStarted, "Debug session should start"); - assert.equal(startDebugSession!.name, interactiveSessionConfig.name, "Debug session name should match when started"); - // debugSession var should be populated from the event before startDebugging completes - await debug.stopDebugging(startDebugSession!); + const config = defaultDebugConfigurations[DebugConfig.InteractiveSession]; + assert.ok(await debug.startDebugging(undefined, config), "Debug session should start"); + assert.equal((await startDebugSession).name, config.name, "Debug session name should match when started"); - assert.equal(stopDebugSession!.name, interactiveSessionConfig.name, "Debug session name should match when stopped"); - assert.equal(stopDebugSession!.configuration.internalConsoleOptions, "neverOpen", "Debug session should always have neverOpen internalConsoleOptions"); - assert.ok(stopDebugSession!, "Debug session should stop"); + await debug.stopDebugging(await startDebugSession); + assert.ok(await stopDebugSession, "Debug session should stop"); + assert.equal((await stopDebugSession).name, config.name, "Debug session name should match when stopped"); + assert.equal((await stopDebugSession).configuration.internalConsoleOptions, "neverOpen", "Debug session should always have neverOpen internalConsoleOptions"); }); describe("Binary Modules", () => { diff --git a/test/features/ISECompatibility.test.ts b/test/features/ISECompatibility.test.ts index dbf3df1fd8..792c3dd7bb 100644 --- a/test/features/ISECompatibility.test.ts +++ b/test/features/ISECompatibility.test.ts @@ -73,7 +73,6 @@ describe("ISE compatibility feature", function () { }); describe("Color theme interactions", function () { - this.slow(4000); beforeEach(enableISEMode); function assertISESettings(): void { diff --git a/test/features/RunCode.test.ts b/test/features/RunCode.test.ts index 0568c303e9..c837a798fe 100644 --- a/test/features/RunCode.test.ts +++ b/test/features/RunCode.test.ts @@ -40,7 +40,6 @@ describe("RunCode feature", function () { }); it("Runs Pester tests from a file", async function () { - this.slow(5000); const pesterTests = path.resolve(__dirname, "../../../examples/Tests/SampleModule.Tests.ps1"); assert(checkIfFileExists(pesterTests)); const pesterTestDebugStarted = utils.WaitEvent(vscode.debug.onDidStartDebugSession, diff --git a/test/features/UpdatePowerShell.test.ts b/test/features/UpdatePowerShell.test.ts index e4cf7220a8..2961699530 100644 --- a/test/features/UpdatePowerShell.test.ts +++ b/test/features/UpdatePowerShell.test.ts @@ -107,7 +107,6 @@ describe("UpdatePowerShell feature", function () { }); describe("Which version it gets", function () { - this.slow(2000); it("Would update to LTS", async function() { process.env.POWERSHELL_UPDATECHECK = "LTS"; const version: IPowerShellVersionDetails = {