webdriverio-community / wdio-vscode-service

A service to test VSCode extensions from end to end using WebdriverIO
https://webdriverio-community.github.io/wdio-vscode-service/
MIT License
35 stars 28 forks source link

VSCode 1.94.0 (stable) fails in MacOS #139

Open kgartland-rstudio opened 1 week ago

kgartland-rstudio commented 1 week ago

VSCode updated to 1.94.0 yesterday, now if I use browserVersion: "stable" in my wdio.conf file, this error is thrown:

Uncaught Exception: Error: Cannot find package 'electron' imported from /Users/kgartland/work/publishing-client/test/vscode-ui/.wdio-vscode-service/vscode-darwin-1.94.0/Visual Studio Code.app/Contents/Resources/app/out/main.js at packageResolve (/Users/kgartland/work/publishing-client/test/vscode-ui/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:757:9) at moduleResolve (/Users/kgartland/work/publishing-client/test/vscode-ui/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:798:18) at Object.defaultResolve (/Users/kgartland/work/publishing-client/test/vscode-ui/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:912:11) at /Users/kgartland/work/publishing-client/test/vscode-ui/node_modules/ts-node/src/esm.ts:218:35 at entrypointFallback (/Users/kgartland/work/publishing-client/test/vscode-ui/node_modules/ts-node/src/esm.ts:168:34) at /Users/kgartland/work/publishing-client/test/vscode-ui/node_modules/ts-node/src/esm.ts:217:14 at addShortCircuitFlag (/Users/kgartland/work/publishing-client/test/vscode-ui/node_modules/ts-node/src/esm.ts:409:21) at resolve (/Users/kgartland/work/publishing-client/test/vscode-ui/node_modules/ts-node/src/esm.ts:197:12) at nextResolve (node:internal/modules/esm/hooks:866:28) at Hooks.resolve (node:internal/modules/esm/hooks:304:30)

If I revert to browserVersion: "1.93.0", it works properly.

MacOS 15.0 Chip Apple M2 Pro

stable continues to work in Windows and Linux OSes.

kgartland-rstudio commented 4 days ago

1.94.1 was just released and that seems to be breaking all other OS'es now.

Error on Ubuntu22:

Execution of 2 workers started at 2024-10-08T17:11:18.533Z

2024-10-08T17:11:18.927Z INFO @wdio/cli:launcher: Run onPrepare hook 2024-10-08T17:11:18.928Z INFO wdio-vscode-service/launcher: Fetch releases from https://update.code.visualstudio.com/api/releases/stable 2024-10-08T17:11:19.282Z INFO @wdio/local-runner: Shutting down spawned worker 2024-10-08T17:11:19.533Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully 2024-10-08T17:11:19.534Z INFO @wdio/local-runner: shutting down SevereServiceError in "onPrepare" SevereServiceError: A service failed in the 'onPrepare' hook SevereServiceError: Couldn't fetch Chromedriver version: Unexpected token : in JSON at position 3 at VSCodeServiceLauncher._fetchChromedriverVersion (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/wdio-vscode-service/src/launcher.ts:252:19) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async VSCodeServiceLauncher._setupVSCodeDesktop (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/wdio-vscode-service/src/launcher.ts:172:37) at async VSCodeServiceLauncher.onPrepare (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/wdio-vscode-service/src/launcher.ts:95:17) at async file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/@wdio/cli/build/utils.js:42:17 at async Promise.all (index 0) at async Launcher.run (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/@wdio/cli/build/launcher.js:93:13)

Stopping runner... at file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/@wdio/cli/build/utils.js:58:35 at processTicksAndRejections (node:internal/process/task_queues:95:5) at async Launcher.run (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/@wdio/cli/build/launcher.js:93:13) HookError [SevereServiceError]: A service failed in the 'onPrepare' hook SevereServiceError: Couldn't fetch Chromedriver version: Unexpected token : in JSON at position 3 at VSCodeServiceLauncher._fetchChromedriverVersion (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/wdio-vscode-service/src/launcher.ts:252:19) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async VSCodeServiceLauncher._setupVSCodeDesktop (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/wdio-vscode-service/src/launcher.ts:172:37) at async VSCodeServiceLauncher.onPrepare (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/wdio-vscode-service/src/launcher.ts:95:17) at async file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/@wdio/cli/build/utils.js:42:17 at async Promise.all (index 0) at async Launcher.run (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/@wdio/cli/build/launcher.js:93:13)

Stopping runner... at file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/@wdio/cli/build/utils.js:58:35 at processTicksAndRejections (node:internal/process/task_queues:95:5) at async Launcher.run (file:///home/runner/work/publisher/publisher/test/vscode-ui/node_modules/@wdio/cli/build/launcher.js:93:13) { origin: 'onPrepare' }

christian-bromann commented 4 days ago

Couldn't fetch Chromedriver version: Unexpected token

Seems to be related with fetching the right Chromedriver version.

kgartland-rstudio commented 4 days ago

Couldn't fetch Chromedriver version: Unexpected token

Seems to be related with fetching the right Chromedriver version.

I was able to fix that issue by installing chromedriver separately in my GitHub Action. However the original issue with 1.94.0 failing on macOS persists.

Any ideas there?

kgartland-rstudio commented 2 days ago

I've installed electron but now get this error. This is using electron version 32.2.0. It looks like this is the issue:

SyntaxError: Named export 'crashReporter' not found. The requested module 'electron' is a CommonJS module, which may not support all module.exports as named exports.

Full error:

Uncaught Exception: file:///Users/kgartland/work/publishing-client/test/vscode-ui/.wdio-vscode-service/vscode-darwin-1.94.1/Visual%20Studio%20Code.app/Contents/Resources/app/out/main.js:16 }).toString("base64")},import.meta.url),globalThis._VSCODE_PRODUCTJSON={...},process.env.VSCODE_DEV)try{const e=ke("../product.overrides.json");globalThis._VSCODE_PRODUCT_JSON=Object.assign(globalThis._VSCODE_PRODUCT_JSON,e)}catch{}globalThis._VSCODE_PACKAGE_JSON={...Re},globalThis._VSCODE_FILE_ROOT=Ue;var B=void 0;function Fe(){return B||(B=Ie()),B}async function Ie(){S("code/amd/willLoadNls");let e,r;if(process.env.VSCODE_NLS_CONFIG)try{e=JSON.parse(process.env.VSCODE_NLS_CONFIG),e?.languagePack?.messagesFile?r=e.languagePack.messagesFile:e?.defaultMessagesFile&&(r=e.defaultMessagesFile),globalThis._VSCODE_NLS_LANGUAGE=e?.resolvedLanguage}catch(t){console.error(Error reading VSCODE_NLS_CONFIG from environment: ${t})}if(!(process.env.VSCODE_DEV||!r)){try{globalThis._VSCODE_NLS_MESSAGES=JSON.parse((await $.promises.readFile(r)).toString())}catch(t){if(console.error(Error reading NLS messages file ${r}: ${t}),e?.languagePack?.corruptMarkerFile)try{await $.promises.writeFile(e.languagePack.corruptMarkerFile,"corrupted")}catch(o){console.error(Error writing corrupted NLS marker file: ${o})}if(e?.defaultMessagesFile&&e.defaultMessagesFile!==r)try{globalThis._VSCODE_NLS_MESSAGES=JSON.parse((await $.promises.readFile(e.defaultMessagesFile)).toString())}catch(o){console.error(Error reading default NLS messages file ${e.defaultMessagesFile}: ${o})}}return S("code/amd/didLoadNls"),e}}ne.exports.load=function(e,r,t){e&&(e=./${e}.js,r=r||function(){},t=t||function(o){console.error(o)},Fe().then(()=>{S("code/fork/willLoadCode"),import(e).then(r,t)}))};var Me=ne.exports.load;import{fileURLToPath as Ve}from"url";import{app as m,protocol as Ge,crashReporter as $e,Menu as He,contentTracing as We}from"electron";import Be from"minimist";var T={exports:{}};(function(){function r(){const t=/("[^"\](?:\.[^"\])")|('[^'\](?:\.[^'\])')|(\/*[^\/*](?:(?:*|\/)[^\/*])?*\/)|(\/{2,}.?(?:(?:\r?\n)|$))|(,\s*[}]])/g;function o(n){return n.replace(t,function(a,l,c,i,u,f){if(i)return"";if(u){const p=u.length;return u[p-1]===`

SyntaxError: Named export 'crashReporter' not found. The requested module 'electron' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using:

import pkg from 'electron'; const {..._},process.env.VSCODE_DEV)try{const e=ke("../product.overrides.json");globalThis._VSCODE_PRODUCT_JSON=Object.assign(globalThis._VSCODE_PRODUCT_JSON,e)}catch{}globalThis._VSCODE_PACKAGE_JSON={...Re},globalThis._VSCODE_FILE_ROOT=Ue;var B=void 0;function Fe(){return B||(B=Ie()),B}async function Ie(){S("code/amd/willLoadNls");let e,r;if(process.env.VSCODE_NLS_CONFIG)try{e=JSON.parse(process.env.VSCODE_NLS_CONFIG),e?.languagePack?.messagesFile?r=e.languagePack.messagesFile:e?.defaultMessagesFile&&(r=e.defaultMessagesFile),globalThis._VSCODE_NLS_LANGUAGE=e?.resolvedLanguage}catch(t){console.error(Error reading VSCODE_NLS_CONFIG from environment: ${t})}if(!(process.env.VSCODE_DEV||!r)){try{globalThis._VSCODE_NLS_MESSAGES=JSON.parse((await $.promises.readFile(r)).toString())}catch(t){if(console.error(Error reading NLS messages file ${r}: ${t}),e?.languagePack?.corruptMarkerFile)try{await $.promises.writeFile(e.languagePack.corruptMarkerFile,"corrupted")}catch(o){console.error(Error writing corrupted NLS marker file: ${o})}if(e?.defaultMessagesFile&&e.defaultMessagesFile!==r)try{globalThis._VSCODE_NLS_MESSAGES=JSON.parse((await $.promises.readFile(e.defaultMessagesFile)).toString())}catch(o){console.error(Error reading default NLS messages file ${e.defaultMessagesFile}: ${o})}}return S("code/amd/didLoadNls"),e}}ne.exports.load=function(e,r,t){e&&(e=./${e}.js,r=r||function(){},t=t||function(o){console.error(o)},Fe().then(()=>{S("code/fork/willLoadCode"),import(e).then(r,t)}))};var Me=ne.exports.load;import{fileURLToPath: Ve}

Potentially related: https://code.visualstudio.com/updates/v1_94#_esm-is-shipping-for-vs-code

We are finally shipping our ESM work in VS Code Stable releases. That means that all layers of VS Code core (electron, node.js, browser, workers) use the import and export syntax in JavaScript for module loading and exporting. All usages of our legacy AMD loader are disabled and will be removed as part of our debt week in October.