From 9d4574b10b7a82f57cd462d395cf1fdca0e93090 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Thu, 29 Sep 2022 14:53:09 +0200 Subject: [PATCH 1/3] Handle case when npm would return an error code (#3340) --- .github/workflows/publish/computeState.js | 12 ++++++++---- package-lock.json | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish/computeState.js b/.github/workflows/publish/computeState.js index ece60755..6eb18167 100644 --- a/.github/workflows/publish/computeState.js +++ b/.github/workflows/publish/computeState.js @@ -90,10 +90,14 @@ function npmGetLatestVersion(packageName) { * @returns {boolean} */ function npmExists(packageName, version) { - const output = cp.execSync(`npm show ${packageName}@${version} version`).toString(); - const result = output.split(/\r\n|\r|\n/g)[0]; - if (result.trim().length === 0) { + try { + const output = cp.execSync(`npm show ${packageName}@${version} version`).toString(); + const result = output.split(/\r\n|\r|\n/g)[0]; + if (result.trim().length === 0) { + return false; + } + return true; + } catch (err) { return false; } - return true; } diff --git a/package-lock.json b/package-lock.json index d7cfeeb6..f213b111 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "monaco-editor", - "version": "0.33.0", + "version": "0.34.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "monaco-editor", - "version": "0.33.0", + "version": "0.34.0", "hasInstallScript": true, "license": "MIT", "devDependencies": { From 1575bc8ae916d3fa28016913886df7bfc4009593 Mon Sep 17 00:00:00 2001 From: Alexandru Dima Date: Fri, 30 Sep 2022 15:29:53 +0200 Subject: [PATCH 2/3] Improve smoke tests resilience towards slow loading of modes (#3342) --- test/smoke/smoke.test.js | 53 +++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/test/smoke/smoke.test.js b/test/smoke/smoke.test.js index b29a2b87..d34a11a5 100644 --- a/test/smoke/smoke.test.js +++ b/test/smoke/smoke.test.js @@ -54,7 +54,9 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => { pageErrors.push(e); }); const response = await page.goto(URL); - assert.ok(!!response); + if (!response) { + assert.fail('Failed to load page'); + } assert.strictEqual(response.status(), 200); }); @@ -89,7 +91,7 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => { /** * @param {string} commandId - * @param {any} args + * @param {any} [args] * @returns Promise */ async function triggerEditorCommand(commandId, args) { @@ -127,27 +129,40 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => { test('html smoke test', async () => { await createEditor('hi', 'html'); - // trigger hover - await focusEditor(); - await setEditorPosition(1, 3); - await page.keyboard.press('F1'); - await page.keyboard.type('Show Hover'); - await page.keyboard.press('Enter'); + // 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 + await focusEditor(); + await setEditorPosition(1, 3); + await page.keyboard.press('F1'); + await page.keyboard.type('Show Hover'); + await page.keyboard.press('Enter'); - // check that a hover explaining the `` 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`); + // check that a hover explaining the `<title>` element appears, which indicates that the language service is up and running + try { + await page.waitForSelector( + `text=The title element represents the document's title or name`, + { timeout: 5000 } + ); + } catch (err) {} + } }); test('json smoke test', async () => { await createEditor('{}', 'json'); - // trigger suggestions - await focusEditor(); - await setEditorPosition(1, 2); - await triggerEditorCommand('editor.action.triggerSuggest'); + // 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 + await focusEditor(); + await setEditorPosition(1, 2); + await triggerEditorCommand('editor.action.triggerSuggest'); - // check that a suggestion item for `$schema` appears, which indicates that the language service is up and running - await page.waitForSelector(`text=$schema`); + // check that a suggestion item for `$schema` appears, which indicates that the language service is up and running + try { + await page.waitForSelector(`text=$schema`, { timeout: 5000 }); + } catch (err) {} + } }); 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 await page.waitForSelector('.squiggly-error'); + // at this point we know that the web worker is healthy, so we can trigger suggestions + // trigger suggestions await focusEditor(); await setEditorPosition(1, 11); @@ -169,7 +186,9 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => { const url = worker.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 assert.strictEqual(await tsWorker.evaluate(`typeof ts`), 'object'); From ab889ff2ccf1bf882aa12fbbeeab6ad01f2e0546 Mon Sep 17 00:00:00 2001 From: Andrew Branch <andrewbranch@users.noreply.github.com> Date: Fri, 30 Sep 2022 06:32:54 -0700 Subject: [PATCH 3/3] Update @types/node (#3334) --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index f213b111..bacc2049 100644 --- a/package-lock.json +++ b/package-lock.json @@ -164,9 +164,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "17.0.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.14.tgz", - "integrity": "sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng==", + "version": "18.7.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz", + "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==", "dev": true }, "node_modules/@types/yauzl": { @@ -3270,9 +3270,9 @@ "dev": true }, "@types/node": { - "version": "17.0.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.14.tgz", - "integrity": "sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng==", + "version": "18.7.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz", + "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==", "dev": true }, "@types/yauzl": {