Skip to content

Commit 4364758

Browse files
committed
Add asserts avoiding open shells
1 parent 0c99e61 commit 4364758

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

Diff for: packages/e2e-tests/test/e2e-editor.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ describe('external editor e2e', function () {
4545

4646
afterEach(async function () {
4747
try {
48+
TestShell.assertNoOpenShells();
4849
await fs.rm(homedir, { recursive: true, force: true });
4950
} catch (err: any) {
5051
// On Windows in CI, this can fail with EPERM for some reason.

Diff for: packages/e2e-tests/test/e2e-tls.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describe('e2e TLS', function () {
5959

6060
after(async function () {
6161
try {
62+
TestShell.assertNoOpenShells();
6263
await fs.rm(homedir, { recursive: true, force: true });
6364
} catch (err: any) {
6465
// On Windows in CI, this can fail with EPERM for some reason.

Diff for: packages/e2e-tests/test/e2e.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,7 @@ describe('e2e', function () {
13791379

13801380
afterEach(async function () {
13811381
try {
1382+
TestShell.assertNoOpenShells();
13821383
await fs.rm(homedir, { recursive: true, force: true });
13831384
} catch (err: any) {
13841385
// On Windows in CI, this can fail with EPERM for some reason.

Diff for: packages/e2e-tests/test/test-shell.ts

+8
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ export class TestShell {
166166
);
167167
}
168168

169+
static assertNoOpenShells() {
170+
assert.strictEqual(
171+
TestShell._openShells.length,
172+
0,
173+
'Expected TestShell to be enabled, did you call cleanTestShellsAfter or cleanTestShellsAfterEach? Or did you call TestShell.start in an after hook?'
174+
);
175+
}
176+
169177
debugInformation() {
170178
return {
171179
pid: this.process.pid,

0 commit comments

Comments
 (0)