mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 16:25:00 +01:00
* Add argument parsing, suite filtering, and grep support to integration test scripts - Add --run, --runGlob, --grep, --suite, and --help argument parsing - --suite selects extension host test suites (comma-separated, glob patterns) - --grep forwards test name filter to all runners via MOCHA_GREP env var - Validate --suite filter matches at least one known suite - Add MOCHA_GREP support to testrunner.js, CSS and HTML test runners - Seed user settings to suppress dock bounce notifications - Always apply *.integrationTest.js glob for node.js tests - Add integration-tests skill documentation * Address Copilot review feedback - Quote cd $ROOT, rm -rf $VSCODEUSERDATADIR, rmdir %VSCODEUSERDATADIR% - Quote --runGlob pattern to prevent premature glob expansion - Use GREP_ARGS array for safe grep forwarding in .sh - Use conditional call with proper quoting for grep in .bat - Deduplicate suite list into KNOWN_SUITES variable - Remove unused EXTRA_ARGS and ARGS variables from .bat * Fix Windows CI: remove unnecessary enabledelayedexpansion The original script used plain 'setlocal'. Adding 'enabledelayedexpansion' may affect path resolution behavior on Windows CI. Since no delayed expansion (\!var\!) syntax is used, revert to the original 'setlocal'. * Fix Windows CI: capture %~dp0 before call :label corrupts it In Windows batch, 'call :label' can change what %~dp0 resolves to. Our should_run_suite subroutine uses 'call :should_run_suite', which caused %~dp0 to resolve to the wrong directory for extension paths that appear after the subroutine call. Capture the script directory once at startup into %SCRIPT_DIR% and use it everywhere.
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
//@ts-check
|
|
'use strict';
|
|
|
|
const paths = require('path');
|
|
const glob = require('glob');
|
|
// Linux: prevent a weird NPE when mocha on Linux requires the window size from the TTY
|
|
// Since we are not running in a tty environment, we just implement the method statically
|
|
const tty = require('tty');
|
|
// @ts-ignore
|
|
if (!tty.getWindowSize) {
|
|
// @ts-ignore
|
|
tty.getWindowSize = function () { return [80, 75]; };
|
|
}
|
|
const Mocha = require('mocha');
|
|
|
|
let mocha = new Mocha({
|
|
ui: 'tdd',
|
|
color: true
|
|
});
|
|
|
|
exports.configure = function configure(opts) {
|
|
if (process.env.MOCHA_GREP) {
|
|
opts.grep = process.env.MOCHA_GREP;
|
|
}
|
|
mocha = new Mocha(opts);
|
|
};
|
|
|
|
exports.run = function run(testsRoot, clb) {
|
|
// Enable source map support
|
|
require('source-map-support').install();
|
|
|
|
// Glob test files
|
|
glob('**/**.test.js', { cwd: testsRoot }, function (error, files) {
|
|
if (error) {
|
|
return clb(error);
|
|
}
|
|
try {
|
|
// Fill into Mocha
|
|
files.forEach(function (f) { return mocha.addFile(paths.join(testsRoot, f)); });
|
|
// Run the tests
|
|
mocha.run(function (failures) {
|
|
clb(null, failures);
|
|
});
|
|
}
|
|
catch (error) {
|
|
return clb(error);
|
|
}
|
|
});
|
|
};
|