Skip to content

A few test cases fail if the project directory is located in a deep place #16305

Closed

Description

@magurotuna

The following two test cases fail if they are located in a deeply nested place.

  • integration::run::queue_microtask_error_handled
  • integration::run::report_error_handled

Output:

OUTPUT
1
{
  cancelable: true,
  message: "Uncaught Error: foo",
  filename: "file:///Users/yusuktan/Repos/github.com/magurotuna/deno/cli/tests/testdata/run/report_error_handled....",
  lineno: 18,
  colno: 13,
  error: Error: foo
    at file:///Users/yusuktan/Repos/github.com/magurotuna/deno/cli/tests/testdata/run/report_error_handled.ts:18:13
}
onerror() called Error: foo
    at file:///Users/yusuktan/Repos/github.com/magurotuna/deno/cli/tests/testdata/run/report_error_handled.ts:18:13
2

OUTPUT
EXPECTED
1
{
  cancelable: true,
  message: "Uncaught Error: foo",
  filename: "[WILDCARD]/report_error_handled.ts",
  lineno: 18,
  colno: 13,
  error: Error: foo
    at [WILDCARD]/report_error_handled.ts:18:13
}
onerror() called Error: foo
    at [WILDCARD]/report_error_handled.ts:18:13
2

EXPECTED

Seems like the "filename" field is different between the expected and actual one. The actual output shows the "omitted" file path (notice that the string ends with the ellipsis), probably because I put the project in a deep place.
This test failure doesn't cause any problem on CI, but it would be even better if we could successfully run it regardless of each individual's setup.

Activity

  1. shogohida commented on Oct 26, 2022

    @shogohida
    Contributor

    @magurotuna
    Hi Tanaka san (I wanted to call you your surname because I'm also Japanese 🙇 ), can I work on this? I'm new to Deno and thought this is a good one for my first issue to contribute.

    By the way, I searched a bit but I couldn't see the reason why filepath has ellipsis... It seems the filepath has ellipsis after 101st character in your case. Therefore, I tried to find something related to this rule but I don't know yet.

    Please let me know if you have any clue!

  2. magurotuna commented on Oct 28, 2022

    @magurotuna
    MemberAuthor

    @shogohida
    Hi 👋 Yes, please do!
    I haven't delve into it yet, but my guess is that elipsis comes from the implementation of console.log().
    Here's one of the test cases that fail.

    itest!(queue_microtask_error_handled {
    args: "run --quiet run/queue_microtask_error_handled.ts",
    output: "run/queue_microtask_error_handled.ts.out",
    });

    This means that the input for this case is this:

    addEventListener("error", (event) => {
    console.log({
    cancelable: event.cancelable,
    message: event.message,
    filename: event.filename,
    lineno: event.lineno,
    colno: event.colno,
    error: event.error,
    });
    event.preventDefault();
    });

    where we use console.log to print the event information.

    The point is that we don't test console.log implementation here, so it's totally fine to use another way to print it. Or you could cut the beginning part of the filename in a heauristic fashion so that it won't get truncated.

  3. shogohida commented on Oct 30, 2022

    @shogohida
    Contributor

    @magurotuna
    Thanks for your advice! I noticed filename of event_listener_error_handled and set_timeout_error_handled has slice method after reading your comment.

    I made a pull request to add slice to queue_microtask_error_handled and report_error_handled!
    #16482

  4. added a commit that references this issue on Oct 31, 2022
    80ed54a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsrelated to tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions