2023-10-13 23:11:05 +03:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
//@ts-check
|
|
|
|
|
2024-10-01 21:48:56 +03:00
|
|
|
import { createRequire } from 'node:module';
|
|
|
|
import { fileURLToPath } from 'url';
|
|
|
|
import * as path from 'path';
|
|
|
|
import * as os from 'os';
|
|
|
|
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
|
2023-10-13 23:11:05 +03:00
|
|
|
const { defineConfig } = require('@vscode/test-cli');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A list of extension folders who have opted into tests, or configuration objects.
|
|
|
|
* Edit me to add more!
|
|
|
|
*
|
|
|
|
* @type {Array<string | (Partial<import("@vscode/test-cli").TestConfiguration> & { label: string })>}
|
|
|
|
*/
|
|
|
|
const extensions = [
|
|
|
|
{
|
|
|
|
label: 'markdown-language-features',
|
|
|
|
workspaceFolder: `extensions/markdown-language-features/test-workspace`,
|
|
|
|
mocha: { timeout: 60_000 }
|
|
|
|
},
|
2023-10-14 00:50:34 +03:00
|
|
|
{
|
|
|
|
label: 'ipynb',
|
2023-10-14 01:36:34 +03:00
|
|
|
workspaceFolder: path.join(os.tmpdir(), `ipynb-${Math.floor(Math.random() * 100000)}`),
|
2023-10-14 00:50:34 +03:00
|
|
|
mocha: { timeout: 60_000 }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'notebook-renderers',
|
2023-10-14 01:36:34 +03:00
|
|
|
workspaceFolder: path.join(os.tmpdir(), `nbout-${Math.floor(Math.random() * 100000)}`),
|
2023-10-14 00:50:34 +03:00
|
|
|
mocha: { timeout: 60_000 }
|
|
|
|
},
|
2023-11-17 22:22:36 +03:00
|
|
|
{
|
|
|
|
label: 'vscode-colorize-tests',
|
|
|
|
workspaceFolder: `extensions/vscode-colorize-tests/test`,
|
|
|
|
mocha: { timeout: 60_000 }
|
|
|
|
},
|
2024-11-05 17:35:58 +03:00
|
|
|
{
|
|
|
|
label: 'vscode-colorize-perf-tests',
|
|
|
|
workspaceFolder: `extensions/vscode-colorize-perf-tests/test`,
|
|
|
|
mocha: { timeout: 6000_000 }
|
|
|
|
},
|
2023-11-17 22:22:36 +03:00
|
|
|
{
|
|
|
|
label: 'configuration-editing',
|
|
|
|
workspaceFolder: path.join(os.tmpdir(), `confeditout-${Math.floor(Math.random() * 100000)}`),
|
|
|
|
mocha: { timeout: 60_000 }
|
|
|
|
},
|
2023-10-16 23:58:44 +03:00
|
|
|
{
|
|
|
|
label: 'github-authentication',
|
|
|
|
workspaceFolder: path.join(os.tmpdir(), `msft-auth-${Math.floor(Math.random() * 100000)}`),
|
|
|
|
mocha: { timeout: 60_000 }
|
2024-08-13 04:42:44 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'microsoft-authentication',
|
|
|
|
mocha: { timeout: 60_000 }
|
2023-10-16 23:58:44 +03:00
|
|
|
}
|
2023-10-13 23:11:05 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
const defaultLaunchArgs = process.env.API_TESTS_EXTRA_ARGS?.split(' ') || [
|
|
|
|
'--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'
|
|
|
|
];
|
|
|
|
|
2024-10-01 21:48:56 +03:00
|
|
|
const config = defineConfig(extensions.map(extension => {
|
2023-10-13 23:11:05 +03:00
|
|
|
/** @type {import('@vscode/test-cli').TestConfiguration} */
|
|
|
|
const config = typeof extension === 'object'
|
|
|
|
? { files: `extensions/${extension.label}/out/**/*.test.js`, ...extension }
|
|
|
|
: { files: `extensions/${extension}/out/**/*.test.js`, label: extension };
|
|
|
|
|
|
|
|
config.mocha ??= {};
|
|
|
|
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
|
|
|
let suite = '';
|
|
|
|
if (process.env.VSCODE_BROWSER) {
|
|
|
|
suite = `${process.env.VSCODE_BROWSER} Browser Integration ${config.label} tests`;
|
|
|
|
} else if (process.env.REMOTE_VSCODE) {
|
|
|
|
suite = `Remote Integration ${config.label} tests`;
|
|
|
|
} else {
|
|
|
|
suite = `Integration ${config.label} tests`;
|
|
|
|
}
|
|
|
|
|
|
|
|
config.mocha.reporter = 'mocha-multi-reporters';
|
|
|
|
config.mocha.reporterOptions = {
|
|
|
|
reporterEnabled: 'spec, mocha-junit-reporter',
|
|
|
|
mochaJunitReporterReporterOptions: {
|
|
|
|
testsuitesTitle: `${suite} ${process.platform}`,
|
|
|
|
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`)
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!config.platform || config.platform === 'desktop') {
|
|
|
|
config.launchArgs = defaultLaunchArgs;
|
|
|
|
config.useInstallation = {
|
2023-10-14 00:49:32 +03:00
|
|
|
fromPath: process.env.INTEGRATION_TEST_ELECTRON_PATH || `${__dirname}/scripts/code.${process.platform === 'win32' ? 'bat' : 'sh'}`,
|
2023-10-13 23:11:05 +03:00
|
|
|
};
|
|
|
|
config.env = {
|
|
|
|
...config.env,
|
|
|
|
VSCODE_SKIP_PRELAUNCH: '1',
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
// web configs not supported, yet
|
|
|
|
}
|
|
|
|
|
|
|
|
return config;
|
|
|
|
}));
|
2024-10-01 21:48:56 +03:00
|
|
|
|
|
|
|
export default config;
|