Files
azuredatastudio/test/monaco/esm-check/esm-check.js
Karl Burtram 8a3d08f0de Merge vscode 1.67 (#20883)
* Fix initial build breaks from 1.67 merge (#2514)

* Update yarn lock files

* Update build scripts

* Fix tsconfig

* Build breaks

* WIP

* Update yarn lock files

* Misc breaks

* Updates to package.json

* Breaks

* Update yarn

* Fix breaks

* Breaks

* Build breaks

* Breaks

* Breaks

* Breaks

* Breaks

* Breaks

* Missing file

* Breaks

* Breaks

* Breaks

* Breaks

* Breaks

* Fix several runtime breaks (#2515)

* Missing files

* Runtime breaks

* Fix proxy ordering issue

* Remove commented code

* Fix breaks with opening query editor

* Fix post merge break

* Updates related to setup build and other breaks (#2516)

* Fix bundle build issues

* Update distro

* Fix distro merge and update build JS files

* Disable pipeline steps

* Remove stats call

* Update license name

* Make new RPM dependencies a warning

* Fix extension manager version checks

* Update JS file

* Fix a few runtime breaks

* Fixes

* Fix runtime issues

* Fix build breaks

* Update notebook tests (part 1)

* Fix broken tests

* Linting errors

* Fix hygiene

* Disable lint rules

* Bump distro

* Turn off smoke tests

* Disable integration tests

* Remove failing "activate" test

* Remove failed test assertion

* Disable other broken test

* Disable query history tests

* Disable extension unit tests

* Disable failing tasks
2022-10-19 19:13:18 -07:00

97 lines
2.5 KiB
JavaScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
const fs = require('fs');
const path = require('path');
const util = require('../../../build/lib/util');
const playwright = require('@playwright/test');
const yaserver = require('yaserver');
const http = require('http');
const DEBUG_TESTS = false;
const SRC_DIR = path.join(__dirname, '../../../out-monaco-editor-core/esm');
const DST_DIR = path.join(__dirname, './out');
const PORT = 8562;
run();
async function run() {
await extractSourcesWithoutCSS();
const server = await startServer();
const browser = await playwright['chromium'].launch({
headless: !DEBUG_TESTS,
devtools: DEBUG_TESTS
// slowMo: DEBUG_TESTS ? 2000 : 0
});
const page = await browser.newPage({
viewport: {
width: 800,
height: 600
}
});
page.on('pageerror', (e) => {
console.error(`[esm-check] A page error occurred:`);
console.error(e);
process.exit(1);
});
const URL = `http://127.0.0.1:${PORT}/index.html`;
console.log(`[esm-check] Navigating to ${URL}`);
const response = await page.goto(URL);
if (!response) {
console.error(`[esm-check] Missing response.`);
process.exit(1);
}
if (response.status() !== 200) {
console.error(`[esm-check] Response status ${response.status()} is not 200 .`);
process.exit(1);
}
console.log(`[esm-check] All appears good.`);
await page.close();
await browser.close();
server.close();
}
/**
* @returns {Promise<http.Server>}
*/
async function startServer() {
const staticServer = await yaserver.createServer({ rootDir: __dirname });
return new Promise((resolve, reject) => {
const server = http.createServer((request, response) => {
return staticServer.handle(request, response);
});
server.listen(PORT, '127.0.0.1', () => {
resolve(server);
});
});
}
async function extractSourcesWithoutCSS() {
await util.rimraf(DST_DIR);
const files = util.rreddir(SRC_DIR);
for (const file of files) {
const srcFilename = path.join(SRC_DIR, file);
if (!/\.js$/.test(srcFilename)) {
continue;
}
const dstFilename = path.join(DST_DIR, file);
let contents = fs.readFileSync(srcFilename).toString();
contents = contents.replace(/import '[^']+\.css';/g, '');
util.ensureDir(path.dirname(dstFilename));
fs.writeFileSync(dstFilename, contents);
}
}