Delay getting workspace uri until tests are running

For #143226
This commit is contained in:
Matt Bierner
2022-02-16 10:59:03 -08:00
parent d67d92591e
commit 21da6eeafa

View File

@@ -15,9 +15,6 @@ function workspaceFile(...segments: string[]) {
return vscode.Uri.joinPath(vscode.workspace.workspaceFolders![0].uri, ...segments);
}
const testDocument = workspaceFile('bower.json');
suite('vscode API - webview', () => {
const disposables: vscode.Disposable[] = [];
@@ -117,7 +114,7 @@ suite('vscode API - webview', () => {
assert.strictEqual(firstResponse.value, 1);
// Swap away from the webview
const doc = await vscode.workspace.openTextDocument(testDocument);
const doc = await vscode.workspace.openTextDocument(workspaceFile('bower.json'));
await vscode.window.showTextDocument(doc);
// And then back
@@ -131,7 +128,7 @@ suite('vscode API - webview', () => {
});
test.skip('webviews should preserve their context when they are moved between view columns', async () => { // TODO@mjbvz https://github.com/microsoft/vscode/issues/141001
const doc = await vscode.workspace.openTextDocument(testDocument);
const doc = await vscode.workspace.openTextDocument(workspaceFile('bower.json'));
await vscode.window.showTextDocument(doc, vscode.ViewColumn.One);
// Open webview in same column
@@ -164,7 +161,7 @@ suite('vscode API - webview', () => {
assert.strictEqual((await firstResponse).value, 1);
// Swap away from the webview
const doc = await vscode.workspace.openTextDocument(testDocument);
const doc = await vscode.workspace.openTextDocument(workspaceFile('bower.json'));
await vscode.window.showTextDocument(doc);
// And then back
@@ -204,7 +201,7 @@ suite('vscode API - webview', () => {
assert.strictEqual(Math.round((await firstResponse).value), 100);
// Swap away from the webview
const doc = await vscode.workspace.openTextDocument(testDocument);
const doc = await vscode.workspace.openTextDocument(workspaceFile('bower.json'));
await vscode.window.showTextDocument(doc);
// And then back
@@ -226,7 +223,7 @@ suite('vscode API - webview', () => {
assert.strictEqual((await firstResponse).value, 1);
// Swap away from the webview
const doc = await vscode.workspace.openTextDocument(testDocument);
const doc = await vscode.workspace.openTextDocument(workspaceFile('bower.json'));
await vscode.window.showTextDocument(doc);
// Try posting a message to our hidden webview