Throwing Error in JavaScript file causes unhandled exception in Log with Jackson parser

Open
#2,001 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript

Research direction

Start with the TestDebugReporter path named in the stack trace and inspect how CommandDebugWrapper metadata is parsed by Jackson when a JavaScript Error is present. Reproduce with a script containing throw new Error("message"), then verify the log displays that message instead of the Jackson unhandled-exception output.

Written by the indexing model from the issue text.

Description

bug js maestro cli P2
Is there an existing issue for this?
  • I have searched the existing issues and didn't find mine.
Steps to reproduce
  1. Create JS file that will perform some action.
  2. Add throw new Error("message") command.
  3. Error might be the single action in the JavaScript file to simplify reproducing
  4. Call this JS file from a test

On failure, the maestro log with have Jackson parser exception.

So, there is no error message from the Error that will help to understand why the test failed, just a useless unhandled exception.

Actual results

Unhandled exception in Jackson parser

Expected results

The message from error is displayed in the log file

About app

Any natove mobile app. Failure may happen before starting the app, if my script is creating test data before the test.

About environment

macOS 14.6.1
java 17.0.11 2024-04-16 LTS

Logs
Logs
[ERROR] maestro.cli.report.TestDebugReporter - Unable to parse commands
com.fasterxml.jackson.databind.JsonMappingException: org.mozilla.javascript.NativeObject cannot be cast to org.mozilla.javascript.NativeError (through reference chain: java.util.ArrayList[2]->maestro.cli.report.CommandDebugWrapper["metadata"]->maestro.cli.report.CommandDebugMetadata["error"]->org.mozilla.javascript.JavaScriptException["value"]->org.mozilla.javascript.NativeError["prototype"]->org.mozilla.javascript.NativeError["stackDelegated"])
Maestro version

14.6.1

How did you install Maestro?

Homebrew

Anything else?

No response

Dominant language
Kotlin
Stars
15.7k
Forks
953
Avg merge
1d 20h
Merged PRs (30d)
32

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mobile-dev-inc/Maestro

All issues in mobile-dev-inc/Maestro

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.