Merge branch 'main' into extend-st-extensions-twincat

This commit is contained in:
PhilippLe 2022-09-30 19:57:29 +02:00 committed by GitHub
commit a31ea7d6c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 29 deletions

View file

@ -90,10 +90,14 @@ function npmGetLatestVersion(packageName) {
* @returns {boolean} * @returns {boolean}
*/ */
function npmExists(packageName, version) { function npmExists(packageName, version) {
try {
const output = cp.execSync(`npm show ${packageName}@${version} version`).toString(); const output = cp.execSync(`npm show ${packageName}@${version} version`).toString();
const result = output.split(/\r\n|\r|\n/g)[0]; const result = output.split(/\r\n|\r|\n/g)[0];
if (result.trim().length === 0) { if (result.trim().length === 0) {
return false; return false;
} }
return true; return true;
} catch (err) {
return false;
}
} }

16
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "monaco-editor", "name": "monaco-editor",
"version": "0.33.0", "version": "0.34.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "monaco-editor", "name": "monaco-editor",
"version": "0.33.0", "version": "0.34.0",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
@ -164,9 +164,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "17.0.14", "version": "18.7.23",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.14.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz",
"integrity": "sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng==", "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==",
"dev": true "dev": true
}, },
"node_modules/@types/yauzl": { "node_modules/@types/yauzl": {
@ -3270,9 +3270,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "17.0.14", "version": "18.7.23",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.14.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz",
"integrity": "sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng==", "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==",
"dev": true "dev": true
}, },
"@types/yauzl": { "@types/yauzl": {

View file

@ -54,7 +54,9 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
pageErrors.push(e); pageErrors.push(e);
}); });
const response = await page.goto(URL); const response = await page.goto(URL);
assert.ok(!!response); if (!response) {
assert.fail('Failed to load page');
}
assert.strictEqual(response.status(), 200); assert.strictEqual(response.status(), 200);
}); });
@ -89,7 +91,7 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
/** /**
* @param {string} commandId * @param {string} commandId
* @param {any} args * @param {any} [args]
* @returns Promise<void> * @returns Promise<void>
*/ */
async function triggerEditorCommand(commandId, args) { async function triggerEditorCommand(commandId, args) {
@ -127,6 +129,8 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
test('html smoke test', async () => { test('html smoke test', async () => {
await createEditor('<title>hi</title>', 'html'); await createEditor('<title>hi</title>', 'html');
// we need to try this a couple of times because the web worker might not be ready yet
for (let attempt = 1; attempt <= 2; attempt++) {
// trigger hover // trigger hover
await focusEditor(); await focusEditor();
await setEditorPosition(1, 3); await setEditorPosition(1, 3);
@ -135,19 +139,30 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
// check that a hover explaining the `<title>` element appears, which indicates that the language service is up and running // check that a hover explaining the `<title>` element appears, which indicates that the language service is up and running
await page.waitForSelector(`text=The title element represents the document's title or name`); try {
await page.waitForSelector(
`text=The title element represents the document's title or name`,
{ timeout: 5000 }
);
} catch (err) {}
}
}); });
test('json smoke test', async () => { test('json smoke test', async () => {
await createEditor('{}', 'json'); await createEditor('{}', 'json');
// we need to try this a couple of times because the web worker might not be ready yet
for (let attempt = 1; attempt <= 2; attempt++) {
// trigger suggestions // trigger suggestions
await focusEditor(); await focusEditor();
await setEditorPosition(1, 2); await setEditorPosition(1, 2);
await triggerEditorCommand('editor.action.triggerSuggest'); await triggerEditorCommand('editor.action.triggerSuggest');
// check that a suggestion item for `$schema` appears, which indicates that the language service is up and running // check that a suggestion item for `$schema` appears, which indicates that the language service is up and running
await page.waitForSelector(`text=$schema`); try {
await page.waitForSelector(`text=$schema`, { timeout: 5000 });
} catch (err) {}
}
}); });
test('typescript smoke test', async () => { test('typescript smoke test', async () => {
@ -156,6 +171,8 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
// check that a squiggle appears, which indicates that the language service is up and running // check that a squiggle appears, which indicates that the language service is up and running
await page.waitForSelector('.squiggly-error'); await page.waitForSelector('.squiggly-error');
// at this point we know that the web worker is healthy, so we can trigger suggestions
// trigger suggestions // trigger suggestions
await focusEditor(); await focusEditor();
await setEditorPosition(1, 11); await setEditorPosition(1, 11);
@ -169,7 +186,9 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
const url = worker.url(); const url = worker.url();
return /ts\.worker\.js$/.test(url) || /workerMain.js#typescript$/.test(url); return /ts\.worker\.js$/.test(url) || /workerMain.js#typescript$/.test(url);
}); });
assert.ok(!!tsWorker); if (!tsWorker) {
assert.fail('Could not find TypeScript worker');
}
// check that the TypeScript worker exposes `ts` as a global // check that the TypeScript worker exposes `ts` as a global
assert.strictEqual(await tsWorker.evaluate(`typeof ts`), 'object'); assert.strictEqual(await tsWorker.evaluate(`typeof ts`), 'object');