Open kettanaito opened 2 years ago
Let me know if there's anything you can advise from the issue description alone. If not, I will try to create a reproduction repository for this.
When I ran chromedriver binary as proposed here, I was able to see a more descriptive error when I ran Spectron:
[6018:0426/132641.654820:INFO:CONSOLE(1)] "TypeError: setTimeout(...).unref is not a function
at IncomingMessage.<anonymous> (/vscode-extension/.vscode-test/vscode-darwin-1.66.2/Visual Studio Code.app/Contents/Resources/app/node_modules.asar/applicationinsights/out/Library/Sender.js:100:117)
at IncomingMessage.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)", source: vscode-file://vscode-app/vscode-extension/.vscode-test/vscode-darwin-1.66.2/Visual%20Studio%20Code.app/Contents/Resources/app/out/bootstrap-window.js (1)
Looks like Spectron runs Chromedriver, which executes VS Code and fails on some setTimeout(...).unref
usage.
Update: This exception seems to be gone if I pass the --disable-telemetry
option to the Spectron args
(forwarded to the vscode instance). Unfortunately, doesn't seem related.
The error itself originates from Chromedriver and its ParseCallFunctionResult
function:
Status ParseCallFunctionResult(const base::Value& temp_result,
--
| std::unique_ptr<base::Value>* result) {
| const base::DictionaryValue* dict;
| if (!temp_result.GetAsDictionary(&dict))
| return Status(kUnknownError, "call function result must be a dictionary");
| absl::optional<int> status_code = dict->FindIntKey("status");
| if (!status_code) {
| return Status(kUnknownError,
// RIGHT HERE
| "call function result missing int 'status'");
| }
| if (*status_code != kOk) {
| std::string message;
| dict->GetString("value", &message);
| return Status(static_cast<StatusCode>(*status_code), message);
| }
| const base::Value* unscoped_value = dict->FindKey("value");
| if (unscoped_value == nullptr) {
| // Missing 'value' indicates the JavaScript code didn't return a value.
| return Status(kOk);
| }
| *result = base::Value::ToUniquePtrValue(unscoped_value->Clone());
| return Status(kOk);
| }
But I fail to spot what sets the "status" key in the "dict". There are no explicit calls of .Set("status"
in the codebase. I suspect the status is set implicitly, for example, inherited from an HTTP call or a process status.
Here's a call stack for this function:
- CallFunction
- CallFunctionWithTimeout
- ParseCallFunctionResult (throws error)
I wish I could see how the CallFunction
is called in the case when the error occurs but I lack the tools/knowledge to perform C++ debugging.
Hi @kettanaito, have you by chance made any headway on this? I'm actually running into the exact same error with spectron v18 and electron v16. If you found a solution I'd love to know what it is. :)
Hey, @arossetter. Alas, I'm stuck on this as well. Sadly, there's been no replies from the project's maintainers. I'd really love to hear some suggestions on how to debug this at least. Same here: if you find anything that moves you forward please let me know!
@kettanaito we're not likely to get replies from the maintainers as Spectron is deprecated (https://github.com/electron-userland/spectron/issues/1045) but I'll definitely return here if I figure something out on my end.
Context
I'm trying to launch a VS Code window using Spectron. Here's the setup:
The VS Code version I'm launching is 1.66.2 with the following environment:
I confirm that
vscodeExecutablePath
is correct as I see the window launching. Yet theapp.start()
throws the following error:Dependencies
Transient dependencies:
Things I've tried
Expected behavior
I can launch the given VS Code executable without issues.