|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
| 6 | +import { AzExtFsExtra } from '@microsoft/vscode-azext-utils'; |
6 | 7 | import * as assert from 'assert'; |
7 | 8 | import * as vscode from 'vscode'; |
8 | 9 | import { getPreLaunchTaskChain } from '../src/debug/getPreLaunchTaskChain'; |
9 | 10 | import type { ITask } from '../src/vsCodeConfig/tasks'; |
10 | 11 | import { getTestWorkspaceFolder } from './global.test'; |
11 | 12 |
|
12 | | -suite('getPreLaunchTaskChain', () => { |
| 13 | +suite.only('getPreLaunchTaskChain', () => { |
13 | 14 | let workspaceFolder: vscode.WorkspaceFolder; |
14 | 15 |
|
15 | | - suiteSetup(function (): void { |
| 16 | + suiteSetup(async function (): Promise<void> { |
16 | 17 | const testPath = getTestWorkspaceFolder(); |
17 | 18 | const folders = vscode.workspace.workspaceFolders; |
18 | 19 | const folder = folders?.find(f => f.uri.fsPath === testPath); |
19 | 20 | if (!folder) { |
20 | 21 | throw new Error(`Could not find workspace folder for path: ${testPath}`); |
21 | 22 | } |
| 23 | + |
| 24 | + await AzExtFsExtra.emptyDir(workspaceFolder.uri.fsPath); |
22 | 25 | workspaceFolder = folder; |
23 | 26 | }); |
24 | 27 |
|
25 | 28 | async function setTasks(tasks: ITask[]): Promise<void> { |
26 | | - await vscode.workspace.getConfiguration('tasks', workspaceFolder.uri).update('tasks', tasks); |
| 29 | + await vscode.workspace.getConfiguration('tasks', workspaceFolder.uri).update('tasks', tasks, vscode.ConfigurationTarget.WorkspaceFolder); |
27 | 30 | } |
28 | 31 |
|
29 | 32 | teardown(async () => { |
30 | | - await vscode.workspace.getConfiguration('tasks', workspaceFolder.uri).update('tasks', undefined); |
| 33 | + await AzExtFsExtra.emptyDir(workspaceFolder.uri.fsPath); |
31 | 34 | }); |
32 | 35 |
|
33 | 36 | test('returns only the preLaunchTask when it has no dependencies', async () => { |
|
0 commit comments