From 7ac32fd01410343ec7be201d614a6e0c342b0b06 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 5 Apr 2023 10:52:10 +0200 Subject: [PATCH] Try to handle `Invalid arguments: should be exactly one string` (#70) --- package.json | 6 +++--- src/index.ts | 15 +++++++++++++-- yarn.lock | 26 +++++++++++++------------- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 283ad1c..d9bbd1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vscode/test-web", - "version": "0.0.37", + "version": "0.0.38", "scripts": { "install-extensions": "yarn --cwd=fs-provider && yarn --cwd=sample", "compile": "tsc -p ./ && yarn compile-fs-provider", @@ -30,7 +30,7 @@ "koa-mount": "^4.0.0", "koa-static": "^5.0.0", "minimist": "^1.2.8", - "playwright": "^1.32.1", + "playwright": "^1.32.2", "vscode-uri": "^3.0.7", "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.1", @@ -51,7 +51,7 @@ "@types/decompress": "^4.2.4", "eslint": "^8.37.0", "eslint-plugin-header": "^3.1.1", - "typescript": "^5.0.2" + "typescript": "^5.0.3" }, "license": "MIT", "author": "Visual Studio Code Team", diff --git a/src/index.ts b/src/index.ts index 96de9a8..7306240 100644 --- a/src/index.ts +++ b/src/index.ts @@ -187,8 +187,15 @@ export async function runTests(options: Options & { extensionTestsPath: string } const context = await openBrowser(endpoint, options); if (context) { context.once('close', () => server.close()); - await context.exposeFunction('codeAutomationLog', (type: 'warn' | 'error' | 'info', args: unknown[]) => { - console[type](...args); + + type Severity = 'error' | 'warning' | 'info'; + const unreportedOutput: { type: Severity, args: unknown[] }[] = []; + await context.exposeFunction('codeAutomationLog', (type: Severity, args: unknown[]) => { + try { + console[type](...args); + } catch (_e) { + unreportedOutput.push({ type, args }); + } }); await context.exposeFunction('codeAutomationExit', async (code: number) => { @@ -197,6 +204,10 @@ export async function runTests(options: Options & { extensionTestsPath: string } } catch (error) { console.error(`Error when closing browser: ${error}`); } + if (unreportedOutput.length) { + console.error(`There were ${unreportedOutput.length} messages that could not be reported to the console:`); + unreportedOutput.forEach(({ type, args }) => console[type](...args)); + } server.close(); if (code === 0) { s(); diff --git a/yarn.lock b/yarn.lock index 922c905..93d0555 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1580,17 +1580,17 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= -playwright-core@1.32.1: - version "1.32.1" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.32.1.tgz#5a10c32403323b07d75ea428ebeed866a80b76a1" - integrity sha512-KZYUQC10mXD2Am1rGlidaalNGYk3LU1vZqqNk0gT4XPty1jOqgup8KDP8l2CUlqoNKhXM5IfGjWgW37xvGllBA== +playwright-core@1.32.2: + version "1.32.2" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.32.2.tgz#608810c3c4486fb86a224732ac0d3560a96ded8b" + integrity sha512-zD7aonO+07kOTthsrCR3YCVnDcqSHIJpdFUtZEMOb6//1Rc7/6mZDRdw+nlzcQiQltOOsiqI3rrSyn/SlyjnJQ== -playwright@^1.32.1: - version "1.32.1" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.32.1.tgz#c48195850740fbdbd7702f37e5a891b13259f689" - integrity sha512-GnEizysWMvoqHC3I9l8+4/ZxeLwLNdJJG76xdKGxzOcIZDcw5RSk/FKrFb5CuA+zcLpjIM2p9eR9Z4CuUDkWXg== +playwright@^1.32.2: + version "1.32.2" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.32.2.tgz#9f5a510274c74d87128f7edfb709016a1f957e01" + integrity sha512-jHVnXJke0PXpuPszKtk9y1zZSlzO5+2a+aockT/AND0oeXx46FiJEFrafthurglLygVZA+1gEbtUM1C7qtTV+Q== dependencies: - playwright-core "1.32.1" + playwright-core "1.32.2" prelude-ls@^1.2.1: version "1.2.1" @@ -1838,10 +1838,10 @@ type-is@^1.6.16: media-typer "0.3.0" mime-types "~2.1.24" -typescript@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.2.tgz#891e1a90c5189d8506af64b9ef929fca99ba1ee5" - integrity sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw== +typescript@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.3.tgz#fe976f0c826a88d0a382007681cbb2da44afdedf" + integrity sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA== unbzip2-stream@^1.0.9: version "1.4.3"