-
Notifications
You must be signed in to change notification settings - Fork 180
/
.vscode-test.mjs
41 lines (35 loc) · 1.33 KB
/
.vscode-test.mjs
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
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { defineConfig } from '@vscode/test-cli';
import fs from 'fs';
import path from 'path';
// Discover test suite folders in src/test/integration
const BASE_SRC_PATH = './src/test/integration';
const BASE_OUT_PATH = './out/test/integration';
const testSuiteFolderNames = fs
.readdirSync(BASE_SRC_PATH, { withFileTypes: true })
.filter((entry) => entry.isDirectory()) // only directories ...
.filter((entry) => fs.existsSync(path.join(BASE_SRC_PATH, entry.name, 'workspace'))) // ... that contain a workspace folder are valid
.map((entry) => entry.name);
const configs = testSuiteFolderNames.map((folderName) => ({
label: `Integration Tests - ${folderName}`,
version: process.env['VSCODE_VERSION'] ?? 'stable',
workspaceFolder: process.env['VSCODE_WORKSPACE_FOLDER'] ?? path.join(BASE_SRC_PATH, folderName, 'workspace'),
launchArgs: ['--disable-extensions', '--disable-workspace-trust'],
files: `${BASE_OUT_PATH}/${folderName}/*.test.js`,
mocha: {
ui: 'tdd',
color: true,
timeout: 100000,
require: ['./out/test/mockSetup.js'], // mocks are shared for all test suites
},
}));
const config = defineConfig({
tests: configs,
coverage: {
exclude: ['src/test/**', '**/node_modules/**', '**/dist/**'],
},
});
export default config;