From 12edc20160fb23439345db16a6a3ad039dea1fbc Mon Sep 17 00:00:00 2001 From: Marc Dumais Date: Wed, 8 Feb 2023 10:32:00 -0500 Subject: [PATCH] [browser tests] [keybindings] Squash intermittent heisenbug This one was tricky to find. An exception would happen that failed the current test file, usually launch-preferences.spec.js, only when running the full browser test suite. However, if that file was removed, the exception would happen in another file, and another file... Turns-out it's related to the vscode.json-language-features built-in extension and playing with the package.json file. It seems the problem is with the Language LinkProvider feature, and its usage by the json-language-features extension. But I could not reproduce it outside of the test suite. Here's what the exception looks-like: root INFO 1) Launch Preferences "before all" hook in "Launch Preferences": Uncaught Error: Uncaught Error: There is no document for file:///home//theia/examples/browser/package.json Error: There is no document for file:///home//theia/examples/browser/package.json at LinkProviderAdapter.provideLinks (/home//theia/packages/plugin-ext/lib/plugin/languages/link-provider.js:31:35) at /home//theia/packages/plugin-ext/lib/plugin/languages.js:332:97 at LanguagesExtImpl.withAdapter (/home//theia/packages/plugin-ext/lib/plugin/languages.js:123:20) at LanguagesExtImpl.$provideDocumentLinks (/home//theia/packages/plugin-ext/lib/plugin/languages.js:332:21) at /home//theia/packages/plugin-ext/lib/common/proxy-handler.js:91:71 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async RpcProtocol.handleRequest (/home//theia/packages/core/lib/common/message-rpc/rpc-protocol.js:167:28) (http://127.0.0.1:3000/vendors-node_modules_theia_monaco-editor-core_esm_vs_base_common_severity_js-node_modules_the-68fc42.js:1785) I went with a simple fix: have the keybindings tests use an alternative file instad of package.json. Signed-off-by: Marc Dumais --- examples/api-tests/src/keybindings.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/api-tests/src/keybindings.spec.js b/examples/api-tests/src/keybindings.spec.js index b061613031f00..55b6f04fe5b04 100644 --- a/examples/api-tests/src/keybindings.spec.js +++ b/examples/api-tests/src/keybindings.spec.js @@ -73,7 +73,7 @@ describe('Keybindings', function () { when: 'false' })); - const editor = await editorManager.open(workspaceService.tryGetRoots()[0].resource.resolve('package.json'), { + const editor = await editorManager.open(workspaceService.tryGetRoots()[0].resource.resolve('webpack.config.js'), { mode: 'activate', selection: { start: { @@ -83,7 +83,6 @@ describe('Keybindings', function () { } }); toTearDown.push(editor); - const waitForCommand = new Deferred(); toTearDown.push(commands.onWillExecuteCommand(e => waitForCommand.resolve(e.commandId))); keybindings.dispatchKeyDown({