Cleanup dependencies (#195026)

* move build dependencies to devDependencies

* build: bump tree-sitter

* dependencies cleanup

* remove leftover file
This commit is contained in:
João Moreno
2023-10-09 08:34:15 +01:00
committed by GitHub
parent 55d1cfea45
commit a5d71aad39
15 changed files with 382 additions and 903 deletions

View File

@@ -11,24 +11,50 @@ import * as tmp from 'tmp';
import * as rimraf from 'rimraf';
import { URI } from 'vscode-uri';
import * as kill from 'tree-kill';
import * as optimistLib from 'optimist';
import * as minimist from 'minimist';
import { promisify } from 'util';
import { promises } from 'fs';
const root = path.join(__dirname, '..', '..', '..', '..');
const logsPath = path.join(root, '.build', 'logs', 'integration-tests-browser');
const optimist = optimistLib
.describe('workspacePath', 'path to the workspace (folder or *.code-workspace file) to open in the test').string('workspacePath')
.describe('extensionDevelopmentPath', 'path to the extension to test').string('extensionDevelopmentPath')
.describe('extensionTestsPath', 'path to the extension tests').string('extensionTestsPath')
.describe('debug', 'do not run browsers headless').boolean('debug')
.describe('browser', 'browser in which integration tests should run').string('browser').default('browser', 'chromium')
.describe('help', 'show the help').alias('help', 'h');
const args = minimist(process.argv.slice(2), {
string: [
// path to the workspace (folder or *.code-workspace file) to open in the test
'workspacePath',
// path to the extension to test
'extensionDevelopmentPath',
// path to the extension tests
'extensionTestsPath',
// browser in which integration tests should run
'browser',
],
boolean: [
'help',
// do not run browsers headless
'debug',
],
alias: {
h: 'help'
},
default: {
'browser': 'chromium'
}
});
if (optimist.argv.help) {
optimist.showHelp();
process.exit(0);
if (args.help) {
console.error(`Integration test runner for VS Code in the browser
Usage: node integration-tests-browser/out/index.js [options]
--workspacePath <path> Path to the workspace (folder or *.code-workspace file) to open in the test
--extensionDevelopmentPath <path> Path to the extension to test
--extensionTestsPath <path> Path to the extension tests
--browser <browser> Browser in which integration tests should run
--debug Do not run browsers headless
--help Print this help message
`);
process.exit(1);
}
const width = 1200;
@@ -37,7 +63,7 @@ const height = 800;
type BrowserType = 'chromium' | 'firefox' | 'webkit';
async function runTestsInBrowser(browserType: BrowserType, endpoint: url.UrlWithStringQuery, server: cp.ChildProcess): Promise<void> {
const browser = await playwright[browserType].launch({ headless: !Boolean(optimist.argv.debug) });
const browser = await playwright[browserType].launch({ headless: !Boolean(args.debug) });
const context = await browser.newContext();
const page = await context.newPage();
@@ -97,9 +123,9 @@ async function runTestsInBrowser(browserType: BrowserType, endpoint: url.UrlWith
const host = endpoint.host;
const protocol = 'vscode-remote';
const testWorkspacePath = URI.file(path.resolve(optimist.argv.workspacePath)).path;
const testExtensionUri = url.format({ pathname: URI.file(path.resolve(optimist.argv.extensionDevelopmentPath)).path, protocol, host, slashes: true });
const testFilesUri = url.format({ pathname: URI.file(path.resolve(optimist.argv.extensionTestsPath)).path, protocol, host, slashes: true });
const testWorkspacePath = URI.file(path.resolve(args.workspacePath)).path;
const testExtensionUri = url.format({ pathname: URI.file(path.resolve(args.extensionDevelopmentPath)).path, protocol, host, slashes: true });
const testFilesUri = url.format({ pathname: URI.file(path.resolve(args.extensionTestsPath)).path, protocol, host, slashes: true });
const payloadParam = `[["extensionDevelopmentPath","${testExtensionUri}"],["extensionTestsPath","${testFilesUri}"],["enableProposedApi",""],["webviewExternalEndpointCommit","ef65ac1ba57f57f2a3961bfe94aa20481caca4c6"],["skipWelcome","true"]]`;
@@ -145,14 +171,14 @@ async function launchServer(browserType: BrowserType): Promise<{ endpoint: url.U
const { serverApplicationName } = require(path.join(process.env.VSCODE_REMOTE_SERVER_PATH, 'product.json'));
serverLocation = path.join(process.env.VSCODE_REMOTE_SERVER_PATH, 'bin', `${serverApplicationName}${process.platform === 'win32' ? '.cmd' : ''}`);
if (optimist.argv.debug) {
if (args.debug) {
console.log(`Starting built server from '${serverLocation}'`);
}
} else {
serverLocation = path.join(root, `scripts/code-server.${process.platform === 'win32' ? 'bat' : 'sh'}`);
process.env.VSCODE_DEV = '1';
if (optimist.argv.debug) {
if (args.debug) {
console.log(`Starting server out of sources from '${serverLocation}'`);
}
}
@@ -161,7 +187,7 @@ async function launchServer(browserType: BrowserType): Promise<{ endpoint: url.U
console.log(`Storing log files into '${serverLogsPath}'`);
serverArgs.push('--logsPath', serverLogsPath);
const stdio: cp.StdioOptions = optimist.argv.debug ? 'pipe' : ['ignore', 'pipe', 'ignore'];
const stdio: cp.StdioOptions = args.debug ? 'pipe' : ['ignore', 'pipe', 'ignore'];
const serverProcess = cp.spawn(
serverLocation,
@@ -169,7 +195,7 @@ async function launchServer(browserType: BrowserType): Promise<{ endpoint: url.U
{ env, stdio }
);
if (optimist.argv.debug) {
if (args.debug) {
serverProcess.stderr!.on('data', error => console.log(`Server stderr: ${error}`));
serverProcess.stdout!.on('data', data => console.log(`Server stdout: ${data}`));
}
@@ -194,8 +220,8 @@ async function launchServer(browserType: BrowserType): Promise<{ endpoint: url.U
});
}
launchServer(optimist.argv.browser).then(async ({ endpoint, server }) => {
return runTestsInBrowser(optimist.argv.browser, endpoint, server);
launchServer(args.browser).then(async ({ endpoint, server }) => {
return runTestsInBrowser(args.browser, endpoint, server);
}, error => {
console.error(error);
process.exit(1);