Tweaks to test running

This commit is contained in:
Daniel Imms
2019-04-10 22:29:43 +02:00
committed by Alex Dima
parent 31e03b8ffb
commit d73c1a61b9
2 changed files with 22 additions and 7 deletions

View File

@@ -58,4 +58,19 @@ export function disposeAll(disposables: vscode.Disposable[]) {
item.dispose();
}
}
}
export function conditionalTest(name: string, testCallback: (done: MochaDone) => void | Thenable<any>) {
if (isTestTypeActive()) {
const async = !!testCallback.length;
if (async) {
test(name, (done) => testCallback(done));
} else {
test(name, () => (<() => void | Thenable<any>>testCallback)());
}
}
}
function isTestTypeActive(): boolean {
return !!vscode.extensions.getExtension('vscode-resolver-test');
}