Помоги сделать GitVerse лучше — пройди опрос
/
.vscode-test.js 
136 строк · 4.6 Кб
1
/*---------------------------------------------------------------------------------------------
2
 *  Copyright (c) Microsoft Corporation. All rights reserved.
3
 *  Licensed under the MIT License. See License.txt in the project root for license information.
4
 *--------------------------------------------------------------------------------------------*/
5

6
//@ts-check
7

8
import { createRequire } from 'node:module';
9
import { fileURLToPath } from 'url';
10
import * as path from 'path';
11
import * as os from 'os';
12

13
const require = createRequire(import.meta.url);
14
const __dirname = path.dirname(fileURLToPath(import.meta.url));
15

16
const { defineConfig } = require('@vscode/test-cli');
17

18
/**
19
 * A list of extension folders who have opted into tests, or configuration objects.
20
 * Edit me to add more!
21
 *
22
 * @type {Array<Partial<import("@vscode/test-cli").TestConfiguration> & { label: string }>}
23
 */
24
const extensions = [
25
	{
26
		label: 'markdown-language-features',
27
		workspaceFolder: `extensions/markdown-language-features/test-workspace`,
28
		mocha: { timeout: 60_000 }
29
	},
30
	{
31
		label: 'ipynb',
32
		workspaceFolder: path.join(os.tmpdir(), `ipynb-${Math.floor(Math.random() * 100000)}`),
33
		mocha: { timeout: 60_000 }
34
	},
35
	{
36
		label: 'notebook-renderers',
37
		workspaceFolder: path.join(os.tmpdir(), `nbout-${Math.floor(Math.random() * 100000)}`),
38
		mocha: { timeout: 60_000 }
39
	},
40
	{
41
		label: 'vscode-colorize-tests',
42
		workspaceFolder: `extensions/vscode-colorize-tests/test`,
43
		mocha: { timeout: 60_000 }
44
	},
45
	{
46
		label: 'terminal-suggest',
47
		workspaceFolder: path.join(os.tmpdir(), `terminal-suggest-${Math.floor(Math.random() * 100000)}`),
48
		mocha: { timeout: 60_000 }
49
	},
50
	{
51
		label: 'vscode-colorize-perf-tests',
52
		workspaceFolder: `extensions/vscode-colorize-perf-tests/test`,
53
		mocha: { timeout: 6000_000 }
54
	},
55
	{
56
		label: 'configuration-editing',
57
		workspaceFolder: path.join(os.tmpdir(), `confeditout-${Math.floor(Math.random() * 100000)}`),
58
		mocha: { timeout: 60_000 }
59
	},
60
	{
61
		label: 'github-authentication',
62
		workspaceFolder: path.join(os.tmpdir(), `msft-auth-${Math.floor(Math.random() * 100000)}`),
63
		mocha: { timeout: 60_000 }
64
	},
65
	{
66
		label: 'microsoft-authentication',
67
		mocha: { timeout: 60_000 }
68
	},
69
	{
70
		label: 'vscode-api-tests-folder',
71
		extensionDevelopmentPath: `extensions/vscode-api-tests`,
72
		workspaceFolder: `extensions/vscode-api-tests/testWorkspace`,
73
		mocha: { timeout: 60_000 },
74
		files: 'extensions/vscode-api-tests/out/singlefolder-tests/**/*.test.js',
75
	},
76
	{
77
		label: 'vscode-api-tests-workspace',
78
		extensionDevelopmentPath: `extensions/vscode-api-tests`,
79
		workspaceFolder: `extensions/vscode-api-tests/testworkspace.code-workspace`,
80
		mocha: { timeout: 60_000 },
81
		files: 'extensions/vscode-api-tests/out/workspace-tests/**/*.test.js',
82
	}
83
];
84

85

86
const defaultLaunchArgs = process.env.API_TESTS_EXTRA_ARGS?.split(' ') || [
87
	'--disable-telemetry', '--skip-welcome', '--skip-release-notes', `--crash-reporter-directory=${__dirname}/.build/crashes`, `--logsPath=${__dirname}/.build/logs/integration-tests`, '--no-cached-data', '--disable-updates', '--use-inmemory-secretstorage', '--disable-extensions', '--disable-workspace-trust'
88
];
89

90
const config = defineConfig(extensions.map(extension => {
91
	/** @type {import('@vscode/test-cli').TestConfiguration} */
92
	const config = {
93
		platform: 'desktop',
94
		files: `extensions/${extension.label}/out/**/*.test.js`,
95
		extensionDevelopmentPath: `extensions/${extension.label}`,
96
		...extension,
97
	};
98

99
	config.mocha ??= {};
100
	if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
101
		let suite = '';
102
		if (process.env.VSCODE_BROWSER) {
103
			suite = `${process.env.VSCODE_BROWSER} Browser Integration ${config.label} tests`;
104
		} else if (process.env.REMOTE_VSCODE) {
105
			suite = `Remote Integration ${config.label} tests`;
106
		} else {
107
			suite = `Integration ${config.label} tests`;
108
		}
109

110
		config.mocha.reporter = 'mocha-multi-reporters';
111
		config.mocha.reporterOptions = {
112
			reporterEnabled: 'spec, mocha-junit-reporter',
113
			mochaJunitReporterReporterOptions: {
114
				testsuitesTitle: `${suite} ${process.platform}`,
115
				mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`)
116
			}
117
		};
118
	}
119

120
	if (!config.platform || config.platform === 'desktop') {
121
		config.launchArgs = defaultLaunchArgs;
122
		config.useInstallation = {
123
			fromPath: process.env.INTEGRATION_TEST_ELECTRON_PATH || `${__dirname}/scripts/code.${process.platform === 'win32' ? 'bat' : 'sh'}`,
124
		};
125
		config.env = {
126
			...config.env,
127
			VSCODE_SKIP_PRELAUNCH: '1',
128
		};
129
	} else {
130
		// web configs not supported, yet
131
	}
132

133
	return config;
134
}));
135

136
export default config;
137

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.