Skip to content

Tap escaping not consistent with and without --test #45836

Description

@MoLow

Version

v20.0.0-pre

Platform

Darwin Moshes-MBP.localdomain 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000 arm64

Subsystem

test_runner

What steps will reproduce the bug?

create test.js

const test = require('node:test');
test('escaped description \\ # \\#\\ \n \t \f \v \b \r');

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

when running without --test:

node test.js

TAP version 13
# Subtest: escaped description \\ \# \\\#\\ \n \t \f \v \b \r
ok 1 - escaped description \\ \# \\\#\\ \n \t \f \v \b \r
  ---
  duration_ms: 1.318167
  ...
1..1
# tests 1
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 3.680459

What do you see instead?

when running with --test

node --test test.js

TAP version 13
# Subtest: /Users/moshe/repos/node/a.js
    # Subtest: escaped description \\ \# \\\#\\ n \\t f \\v b \\r
    ok 1 - escaped description \\ \# \\\#\\ n \\t f \\v b \\r
      ---
      duration_ms: 1.295459
      ...
    1..1
ok 1 - /Users/moshe/repos/node/a.js
  ---
  duration_ms: 80.91975
  ...
1..1
# tests 1
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 81.80225

Additional information

No response

Activity

  1. added
    good first issueIssues that are suitable for first-time contributors.
    test_runnerIssues and PRs related to the test runner subsystem.
    on Dec 13, 2022
  2. debadree25 commented on Dec 13, 2022

    @debadree25
    Contributor

    @MoLow could you guide which relevant files I could look into, can take a stab at this

  3. MoLow commented on Dec 13, 2022

    @MoLow
    MemberAuthor

    I am not sure where the exact issue is, but these can be good places to start the investigation

    function tapEscape(input) {
    let result = StringPrototypeReplaceAll(input, '\\', '\\\\');
    result = StringPrototypeReplaceAll(result, '#', '\\#');
    result = StringPrototypeReplaceAll(result, '\b', '\\b');
    result = StringPrototypeReplaceAll(result, '\f', '\\f');
    result = StringPrototypeReplaceAll(result, '\t', '\\t');
    result = StringPrototypeReplaceAll(result, '\n', '\\n');
    result = StringPrototypeReplaceAll(result, '\r', '\\r');
    result = StringPrototypeReplaceAll(result, '\v', '\\v');
    return result;
    }

    if (nextToken.kind !== TokenKind.ESCAPE) {
    ArrayPrototypePush(literals, word);
    }

  4. MoLow commented on Dec 13, 2022

    @MoLow
    MemberAuthor

    also

    #isEscapeSymbol(char) {

  5. debadree25 commented on Dec 13, 2022

    @debadree25
    Contributor

    Thank you so much looking into it!

  6. 7suyash7 commented on Dec 15, 2022

    @7suyash7
    Contributor
    $ node --test test.js
    TAP version 13
    # Subtest: /test/test.js
    ok 1 - /test.js
      ---
      duration_ms: 0.036416797
      ...
    1..1
    # tests 1
    # pass 1
    # fail 0
    # cancelled 0
    # skipped 0
    # todo 0
    # duration_ms 0.079281594
    

    Has this been fixed, here's the output which I get?

  7. cjihrig commented on Dec 19, 2022

    @cjihrig
    Contributor

    @manekinekko any ideas here?

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

    good first issueIssues that are suitable for first-time contributors.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions