Skip to content

Commit 3ef843a

Browse files
committed
Removed await timeout in tests
1 parent f33ce51 commit 3ef843a

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/test/repository.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { Svn } from "../svn";
1717
import { Model } from "../model";
1818
import { SvnFinder, ISvn } from "../svnFinder";
1919
import { Repository } from "../repository";
20-
import { timeout } from "../util";
2120

2221
// Defines a Mocha test suite to group tests of similar kind together
2322
suite("Repository Tests", () => {
@@ -29,6 +28,8 @@ suite("Repository Tests", () => {
2928
let model: Model;
3029

3130
suiteSetup(async () => {
31+
await testUtil.activeExtension();
32+
3233
repoUri = await testUtil.createRepoServer();
3334
await testUtil.createStandardLayout(testUtil.getSvnUrl(repoUri));
3435
checkoutDir = await testUtil.createRepoCheckout(
@@ -103,15 +104,13 @@ suite("Repository Tests", () => {
103104

104105
await repository.addFiles([file]);
105106

106-
await timeout(1500); // Wait the debounce time
107107
assert.equal(repository.changes.resourceStates.length, 1);
108108

109109
const message = await repository.commitFiles("First Commit", [
110110
file
111111
]);
112112
assert.ok(/Committed revision (.*)\./i.test(message));
113113

114-
await timeout(1500); // Wait the debounce time
115114
assert.equal(repository.changes.resourceStates.length, 0);
116115

117116
const remoteContent = await repository.show(file, "HEAD");

src/test/testUtil.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as cp from "child_process";
22
import * as path from "path";
33
import * as fs from "fs";
44
import * as os from "os";
5-
import { Uri } from "vscode";
5+
import { Uri, extensions } from "vscode";
66
import { SpawnOptions, ChildProcess } from "child_process";
77
import { timeout } from "../util";
88

@@ -161,3 +161,19 @@ export function destroyAllTempPaths() {
161161
destroyPath(path);
162162
}
163163
}
164+
165+
export function activeExtension() {
166+
return new Promise<void>((resolve, reject) => {
167+
const extension = extensions.getExtension("johnstoncode.svn-scm");
168+
if (!extension) {
169+
reject();
170+
return;
171+
}
172+
173+
if (!extension.isActive) {
174+
extension.activate().then(() => resolve(), () => reject());
175+
} else {
176+
resolve();
177+
}
178+
});
179+
}

0 commit comments

Comments
 (0)