|
@@ -9,10 +9,14 @@ const yaserver = require('yaserver');
|
|
const http = require('http');
|
|
const http = require('http');
|
|
const cp = require('child_process');
|
|
const cp = require('child_process');
|
|
const path = require('path');
|
|
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 REPO_ROOT = path.join(__dirname, '../../');
|
|
|
|
+const PORT = 8563;
|
|
|
|
|
|
yaserver
|
|
yaserver
|
|
.createServer({
|
|
.createServer({
|
|
@@ -37,7 +41,7 @@ yaserver
|
|
async function runTests() {
|
|
async function runTests() {
|
|
// uncomment to shortcircuit and run a specific combo
|
|
// uncomment to shortcircuit and run a specific combo
|
|
// await runTest('webpack', 'chromium'); return;
|
|
// await runTest('webpack', 'chromium'); return;
|
|
- /** @type {('amd'|'webpack'|'esbuild'|'vite')[]} */
|
|
|
|
|
|
+ /** @type {PackagerKind[]} */
|
|
const testTypes = ['amd', 'webpack', 'esbuild', 'vite'];
|
|
const testTypes = ['amd', 'webpack', 'esbuild', 'vite'];
|
|
|
|
|
|
for (const type of testTypes) {
|
|
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
|
|
* @returns
|
|
*/
|
|
*/
|
|
-function runTest(type, browser) {
|
|
|
|
|
|
+function runTest(packager, browser) {
|
|
return new Promise((resolve, reject) => {
|
|
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(
|
|
const proc = cp.spawn(
|
|
'node',
|
|
'node',
|
|
[
|
|
[
|