-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathdebugProvider.test.ts
More file actions
78 lines (72 loc) · 2.7 KB
/
debugProvider.test.ts
File metadata and controls
78 lines (72 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { DebugConfiguration, workspace } from 'vscode';
import { StaticWebAppDebugProvider } from '../src/debug/StaticWebAppDebugProvider';
import { getWorkspaceUri } from './testUtils';
interface ITestCase {
workspaceName: string;
configs: DebugConfiguration[];
}
const testCases: ITestCase[] = [
{
workspaceName: 'react-basic',
configs: [
{
"name": "SWA: Run react-basic",
"request": "launch",
"timeout": 30000,
"type": "pwa-chrome",
"url": "http://localhost:4280",
"preLaunchTask": "swa: start react-basic",
// eslint-disable-next-line no-template-curly-in-string
"webRoot": "${workspaceFolder}/"
}
]
},
{
workspaceName: 'angular-basic',
configs: [
{
"name": "SWA: Run angular-basic",
"request": "launch",
"timeout": 30000,
"type": "pwa-chrome",
"url": "http://localhost:4280",
"preLaunchTask": "swa: start angular-basic",
// eslint-disable-next-line no-template-curly-in-string
"webRoot": "${workspaceFolder}/"
}
]
},
{
workspaceName: 'vanilla-basic',
configs: [
{
"name": "SWA: Run app (swa-cli.config.json)",
"request": "launch",
"timeout": 30000,
"type": "pwa-chrome",
"url": "http://localhost:4280",
"preLaunchTask": "swa: start app",
// eslint-disable-next-line no-template-curly-in-string
"webRoot": "${workspaceFolder}/"
}
]
}
];
suite('Debug provider', async () => {
const debugProvider = new StaticWebAppDebugProvider();
for (const testCase of testCases) {
test(testCase.workspaceName, async () => {
const workspaceUri = getWorkspaceUri(testCase.workspaceName);
const workspaceFolder = workspace.getWorkspaceFolder(workspaceUri);
if (workspaceFolder) {
const configs = await debugProvider.provideDebugConfigurations(workspaceFolder);
assert.deepStrictEqual(configs, testCase.configs);
}
});
}
});