未验证 提交 c9a2de2d 编写于 作者: A Alex Dima

Improve integration test output on Windows (#84239)

上级 617a3387
...@@ -20,6 +20,13 @@ const ansiColors = require('ansi-colors'); ...@@ -20,6 +20,13 @@ const ansiColors = require('ansi-colors');
const root = path.dirname(path.dirname(__dirname)); const root = path.dirname(path.dirname(__dirname));
const builtInExtensions = require('../builtInExtensions.json'); const builtInExtensions = require('../builtInExtensions.json');
const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json'); const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json');
const ENABLE_LOGGING = !process.env['VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE'];
function log() {
if (ENABLE_LOGGING) {
fancyLog.apply(this, arguments);
}
}
function getExtensionPath(extension) { function getExtensionPath(extension) {
return path.join(root, '.build', 'builtInExtensions', extension.name); return path.join(root, '.build', 'builtInExtensions', extension.name);
...@@ -44,7 +51,7 @@ function isUpToDate(extension) { ...@@ -44,7 +51,7 @@ function isUpToDate(extension) {
function syncMarketplaceExtension(extension) { function syncMarketplaceExtension(extension) {
if (isUpToDate(extension)) { if (isUpToDate(extension)) {
fancyLog(ansiColors.blue('[marketplace]'), `${extension.name}@${extension.version}`, ansiColors.green('✔︎')); log(ansiColors.blue('[marketplace]'), `${extension.name}@${extension.version}`, ansiColors.green('✔︎'));
return es.readArray([]); return es.readArray([]);
} }
...@@ -53,13 +60,13 @@ function syncMarketplaceExtension(extension) { ...@@ -53,13 +60,13 @@ function syncMarketplaceExtension(extension) {
return ext.fromMarketplace(extension.name, extension.version, extension.metadata) return ext.fromMarketplace(extension.name, extension.version, extension.metadata)
.pipe(rename(p => p.dirname = `${extension.name}/${p.dirname}`)) .pipe(rename(p => p.dirname = `${extension.name}/${p.dirname}`))
.pipe(vfs.dest('.build/builtInExtensions')) .pipe(vfs.dest('.build/builtInExtensions'))
.on('end', () => fancyLog(ansiColors.blue('[marketplace]'), extension.name, ansiColors.green('✔︎'))); .on('end', () => log(ansiColors.blue('[marketplace]'), extension.name, ansiColors.green('✔︎')));
} }
function syncExtension(extension, controlState) { function syncExtension(extension, controlState) {
switch (controlState) { switch (controlState) {
case 'disabled': case 'disabled':
fancyLog(ansiColors.blue('[disabled]'), ansiColors.gray(extension.name)); log(ansiColors.blue('[disabled]'), ansiColors.gray(extension.name));
return es.readArray([]); return es.readArray([]);
case 'marketplace': case 'marketplace':
...@@ -67,15 +74,15 @@ function syncExtension(extension, controlState) { ...@@ -67,15 +74,15 @@ function syncExtension(extension, controlState) {
default: default:
if (!fs.existsSync(controlState)) { if (!fs.existsSync(controlState)) {
fancyLog(ansiColors.red(`Error: Built-in extension '${extension.name}' is configured to run from '${controlState}' but that path does not exist.`)); log(ansiColors.red(`Error: Built-in extension '${extension.name}' is configured to run from '${controlState}' but that path does not exist.`));
return es.readArray([]); return es.readArray([]);
} else if (!fs.existsSync(path.join(controlState, 'package.json'))) { } else if (!fs.existsSync(path.join(controlState, 'package.json'))) {
fancyLog(ansiColors.red(`Error: Built-in extension '${extension.name}' is configured to run from '${controlState}' but there is no 'package.json' file in that directory.`)); log(ansiColors.red(`Error: Built-in extension '${extension.name}' is configured to run from '${controlState}' but there is no 'package.json' file in that directory.`));
return es.readArray([]); return es.readArray([]);
} }
fancyLog(ansiColors.blue('[local]'), `${extension.name}: ${ansiColors.cyan(controlState)}`, ansiColors.green('✔︎')); log(ansiColors.blue('[local]'), `${extension.name}: ${ansiColors.cyan(controlState)}`, ansiColors.green('✔︎'));
return es.readArray([]); return es.readArray([]);
} }
} }
...@@ -94,8 +101,8 @@ function writeControlFile(control) { ...@@ -94,8 +101,8 @@ function writeControlFile(control) {
} }
function main() { function main() {
fancyLog('Syncronizing built-in extensions...'); log('Syncronizing built-in extensions...');
fancyLog(`You can manage built-in extensions with the ${ansiColors.cyan('--builtin')} flag`); log(`You can manage built-in extensions with the ${ansiColors.cyan('--builtin')} flag`);
const control = readControlFile(); const control = readControlFile();
const streams = []; const streams = [];
......
...@@ -11,7 +11,7 @@ const suite = 'Integration CSS Extension Tests'; ...@@ -11,7 +11,7 @@ const suite = 'Integration CSS Extension Tests';
const options = { const options = {
ui: 'tdd', ui: 'tdd',
useColors: true, useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000 timeout: 60000
}; };
......
...@@ -10,7 +10,7 @@ const suite = 'Integration Emmet Tests'; ...@@ -10,7 +10,7 @@ const suite = 'Integration Emmet Tests';
const options: any = { const options: any = {
ui: 'tdd', ui: 'tdd',
useColors: true, useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000 timeout: 60000
}; };
......
...@@ -11,7 +11,7 @@ const suite = 'Integration HTML Extension Tests'; ...@@ -11,7 +11,7 @@ const suite = 'Integration HTML Extension Tests';
const options = { const options = {
ui: 'tdd', ui: 'tdd',
useColors: true, useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000 timeout: 60000
}; };
......
...@@ -10,7 +10,7 @@ const suite = 'Integration Markdown Tests'; ...@@ -10,7 +10,7 @@ const suite = 'Integration Markdown Tests';
const options: any = { const options: any = {
ui: 'tdd', ui: 'tdd',
useColors: true, useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000 timeout: 60000
}; };
......
...@@ -21,7 +21,7 @@ const testRunner = require('vscode/lib/testrunner'); ...@@ -21,7 +21,7 @@ const testRunner = require('vscode/lib/testrunner');
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
testRunner.configure({ testRunner.configure({
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: process.platform !== 'win32', // colored output from test results (only windows cannot handle) useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'), // colored output from test results (only windows cannot handle)
timeout: 60000 timeout: 60000
}); });
......
...@@ -10,7 +10,7 @@ const suite = 'Integration Single Folder Tests'; ...@@ -10,7 +10,7 @@ const suite = 'Integration Single Folder Tests';
const options: any = { const options: any = {
ui: 'tdd', ui: 'tdd',
useColors: true, useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000 timeout: 60000
}; };
......
...@@ -10,7 +10,7 @@ const suite = 'Integration Workspace Tests'; ...@@ -10,7 +10,7 @@ const suite = 'Integration Workspace Tests';
const options: any = { const options: any = {
ui: 'tdd', ui: 'tdd',
useColors: true, useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000 timeout: 60000
}; };
......
...@@ -10,7 +10,7 @@ const suite = 'Integration Colorize Tests'; ...@@ -10,7 +10,7 @@ const suite = 'Integration Colorize Tests';
const options: any = { const options: any = {
ui: 'tdd', ui: 'tdd',
useColors: true, useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
timeout: 60000 timeout: 60000
}; };
......
...@@ -8,7 +8,9 @@ set VSCODEUSERDATADIR=%TMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,5% ...@@ -8,7 +8,9 @@ set VSCODEUSERDATADIR=%TMP%\vscodeuserfolder-%RANDOM%-%TIME:~6,5%
:: Figure out which Electron to use for running tests :: Figure out which Electron to use for running tests
if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" ( if "%INTEGRATION_TEST_ELECTRON_PATH%"=="" (
:: Run out of sources: no need to compile as code.sh takes care of it :: Run out of sources: no need to compile as code.sh takes care of it
chcp 65001
set INTEGRATION_TEST_ELECTRON_PATH=.\scripts\code.bat set INTEGRATION_TEST_ELECTRON_PATH=.\scripts\code.bat
set VSCODE_BUILD_BUILTIN_EXTENSIONS_SILENCE_PLEASE=1
echo "Running integration tests out of sources." echo "Running integration tests out of sources."
) else ( ) else (
...@@ -34,7 +36,6 @@ call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\tes ...@@ -34,7 +36,6 @@ call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\tes
if %errorlevel% neq 0 exit /b %errorlevel% if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\workspace-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
if %errorlevel% neq 0 exit /b %errorlevel% if %errorlevel% neq 0 exit /b %errorlevel%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR% call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-colorize-tests\test --extensionDevelopmentPath=%~dp0\..\extensions\vscode-colorize-tests --extensionTestsPath=%~dp0\..\extensions\vscode-colorize-tests\out --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册