Bring smoketest scripts together (#3370)

This commit is contained in:
Alexandru Dima 2022-10-18 14:20:09 +02:00 committed by GitHub
parent 5d653b2569
commit 2b3d8516c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 1546 additions and 112 deletions

View file

@ -9,10 +9,14 @@ const yaserver = require('yaserver');
const http = require('http');
const cp = require('child_process');
const path = require('path');
const { PORT } = require('./common');
const DEBUG_TESTS = process.argv.includes('--debug-tests');
/** @typedef {import('./common').BrowserKind} BrowserKind */
/** @typedef {import('./common').PackagerKind} PackagerKind */
/** @typedef {import('./common').TestInfo} TestInfo */
const DEBUG_TESTS = process.argv.includes('--debug-tests');
const REPO_ROOT = path.join(__dirname, '../../');
const PORT = 8563;
yaserver
.createServer({
@ -37,7 +41,7 @@ yaserver
async function runTests() {
// uncomment to shortcircuit and run a specific combo
// await runTest('webpack', 'chromium'); return;
/** @type {('amd'|'webpack'|'esbuild'|'vite')[]} */
/** @type {PackagerKind[]} */
const testTypes = ['amd', 'webpack', 'esbuild', 'vite'];
for (const type of testTypes) {
@ -48,16 +52,20 @@ async function runTests() {
}
/**
* @param {'amd'|'webpack'|'esbuild'|'vite'} type
* @param {'chromium'|'firefox'|'webkit'} browser
* @param {PackagerKind} packager
* @param {BrowserKind} browser
* @returns
*/
function runTest(type, browser) {
function runTest(packager, browser) {
return new Promise((resolve, reject) => {
const env = { BROWSER: browser, TESTS_TYPE: type, ...process.env };
if (DEBUG_TESTS) {
env['DEBUG_TESTS'] = 'true';
}
/** @type TestInfo */
const testInfo = {
browser,
packager,
debugTests: DEBUG_TESTS,
port: PORT
};
const env = { MONACO_TEST_INFO: JSON.stringify(testInfo), ...process.env };
const proc = cp.spawn(
'node',
[