Skip to content

Commit 8471670

Browse files
edgardmessiasJohnstonCode
authored andcommitted
test: Fixed spawn ENOENT for svnRepository.test.ts (close #523) (#521)
1 parent 9937428 commit 8471670

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/svnRepository.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ export class Repository {
3535
policy: ConstructorPolicy
3636
) {
3737
if (policy === ConstructorPolicy.LateInit) {
38-
console.error(
39-
"Constructor called in sync fashion, test-only\n",
40-
new Error().stack
41-
);
42-
return;
38+
return ((async (): Promise<Repository> => {
39+
return this;
40+
})() as unknown) as Repository;
4341
}
4442
return ((async (): Promise<Repository> => {
4543
await this.updateInfo();

src/test/commands.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { ISvnResourceGroup } from "../common/types";
1717
import { Model } from "../model";
1818
import { Repository } from "../repository";
1919
import * as testUtil from "./testUtil";
20+
import { timeout } from "../util";
2021

2122
// Defines a Mocha test suite to group tests of similar kind together
2223
suite("Commands Tests", () => {
@@ -174,6 +175,9 @@ suite("Commands Tests", () => {
174175
testUtil.overrideNextShowInputBox("Created new branch test");
175176
await commands.executeCommand("svn.switchBranch");
176177

178+
// Wait run updateRemoteChangedFiles
179+
await timeout(2000);
180+
177181
const repository = model.getRepository(checkoutDir) as Repository;
178182
assert.equal(await repository.getCurrentBranch(), "branches/test");
179183
});
@@ -182,6 +186,9 @@ suite("Commands Tests", () => {
182186
testUtil.overrideNextShowQuickPick(2);
183187
await commands.executeCommand("svn.switchBranch");
184188

189+
// Wait run updateRemoteChangedFiles
190+
await timeout(2000);
191+
185192
const repository = model.getRepository(checkoutDir) as Repository;
186193
assert.equal(await repository.getCurrentBranch(), "trunk");
187194
});

0 commit comments

Comments
 (0)