Skip to content

Commit

Permalink
[browser tests] [keybindings] Squash intermittent heisenbug
Browse files Browse the repository at this point in the history
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/<user>/theia/examples/browser/package.json

        Error: There is no document for file:///home/<user>/theia/examples/browser/package.json
            at LinkProviderAdapter.provideLinks (/home/<user>/theia/packages/plugin-ext/lib/plugin/languages/link-provider.js:31:35)
            at /home/<user>/theia/packages/plugin-ext/lib/plugin/languages.js:332:97
            at LanguagesExtImpl.withAdapter (/home/<user>/theia/packages/plugin-ext/lib/plugin/languages.js:123:20)
            at LanguagesExtImpl.$provideDocumentLinks (/home/<user>/theia/packages/plugin-ext/lib/plugin/languages.js:332:21)
            at /home/<user>/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/<user>/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 <marc.dumais@ericsson.com>
  • Loading branch information
marcdumais-work committed Feb 20, 2023
1 parent 3f38487 commit 12edc20
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions examples/api-tests/src/keybindings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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({
Expand Down

0 comments on commit 12edc20

Please sign in to comment.