- Implemented window delineation tests for indentation-based tokenization. - Created tokenizer module with various tokenization strategies including TTokenizer and ApproximateTokenizer. - Added type definitions for authentication parameters and code citation notifications. - Introduced context provider API for extensions to supply additional context items to Copilot. - Defined core types and schemas for position and range. - Established status types for agent status management in IDEs.
80 lines
2.5 KiB
TypeScript
80 lines
2.5 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { promises as fs } from 'fs';
|
|
import * as os from 'os';
|
|
import * as path from 'path';
|
|
import yargs from 'yargs';
|
|
import { hideBin } from 'yargs/helpers';
|
|
|
|
import { runTests } from '@vscode/test-electron';
|
|
|
|
async function main() {
|
|
const tempdir = await fs.mkdtemp(os.tmpdir() + '/copilot-extension-test-');
|
|
|
|
let exitCode;
|
|
try {
|
|
// The folder containing the Extension Manifest package.json
|
|
// Passed to `--extensionDevelopmentPath`
|
|
const extensionDevelopmentPath = path.resolve(__dirname, '../..');
|
|
|
|
// The path to the extension test script (must be javascript)
|
|
// Passed to --extensionTestsPath
|
|
const extensionTestsPath = path.resolve(__dirname, './run');
|
|
|
|
const launchArgs = [];
|
|
// Disable other extensions while testing,
|
|
launchArgs.push('--disable-extensions');
|
|
|
|
// use a temporary folder so we can run multiple instances of the same VS Code together
|
|
// see https://github.com/microsoft/vscode/issues/137678
|
|
launchArgs.push('--user-data-dir', tempdir);
|
|
|
|
const argv = await yargs(hideBin(process.argv))
|
|
.options({
|
|
stable: {
|
|
type: 'boolean',
|
|
default: false,
|
|
},
|
|
grep: {
|
|
alias: 'g',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
})
|
|
.parse();
|
|
const version = argv.stable ? 'stable' : 'insiders';
|
|
|
|
const extensionTestsEnv: typeof process.env = {};
|
|
// Pass arguments to mocha by environment variables
|
|
if (argv.grep) { extensionTestsEnv.MOCHA_GREP = argv.grep; }
|
|
if (argv._.length > 0) { extensionTestsEnv.MOCHA_FILES = argv._.join('\n'); }
|
|
if (!process.stdout.isTTY) { extensionTestsEnv.NO_COLOR = 'true'; }
|
|
const workspaceFolder = await fs.mkdtemp(path.join(os.tmpdir(), 'copilot-extension-test-'));
|
|
launchArgs.push(workspaceFolder);
|
|
|
|
extensionTestsEnv.CORETEST = 'true';
|
|
//@dbaeumer This can be removed as soon as we have the cache handle CORETEST
|
|
extensionTestsEnv.VITEST = 'true';
|
|
|
|
// Download VS Code, unzip it and run the integration test
|
|
exitCode = await runTests({
|
|
version,
|
|
extensionDevelopmentPath,
|
|
extensionTestsPath,
|
|
launchArgs,
|
|
extensionTestsEnv,
|
|
});
|
|
} catch (err) {
|
|
console.error('Failed to run tests', err);
|
|
exitCode = 1;
|
|
} finally {
|
|
await fs.rm(tempdir, { recursive: true });
|
|
}
|
|
process.exit(exitCode);
|
|
}
|
|
|
|
void main();
|