Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test runner regression in 19.2.0 #46508

Closed
vhiairrassary opened this issue Feb 5, 2023 · 1 comment · Fixed by #45736
Closed

test runner regression in 19.2.0 #46508

vhiairrassary opened this issue Feb 5, 2023 · 1 comment · Fixed by #45736
Labels
test_runner Issues and PRs related to the test runner subsystem.

Comments

@vhiairrassary
Copy link
Contributor

vhiairrassary commented Feb 5, 2023

Version

19.2.0

Platform

Darwin Victors-MacBook-Pro.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64 x86_64

Subsystem

test runner

How to reproduce

Considering a file test.txt is available in the current directory, then the following script does not work anymore starting from 19.2.0 (it crashed on byteLength access):

const { readFile } = require("node:fs/promises");
const { test } = require("node:test");

test("test", async () => {
  const buffer = await readFile("./test.txt");
  console.log(buffer);
  console.log(buffer.byteLength);
});

Works in 19.1.0:

> nodenv shell 19.1.0 && node -v && node --test main.js
v19.1.0
TAP version 13
# Subtest: [redacted]/tmp/main.js
ok 1 - [redacted]/main.js
  ---
  duration_ms: 86.154689
  ...
1..1
# tests 1
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 89.07115

Does not work in 19.2.0:

> nodenv shell 19.2.0 && node -v && node --test main.js
v19.2.0
TAP version 13
# Subtest: [redacted]/tmp/main.js
    # <Buffer >
not ok 1 - [redacted]/tmp/main.js
  ---
  duration_ms: 69.710577
  failureType: 'uncaughtException'
  error: "Cannot read properties of undefined (reading 'value')"
  code: 'ERR_TEST_FAILURE'
  stack: |-
    #Plan (node:internal/test_runner/tap_parser:647:20)
    #TAPDocument (node:internal/test_runner/tap_parser:546:28)
    #parseChunk (node:internal/test_runner/tap_parser:268:35)
    #parseTokens (node:internal/test_runner/tap_parser:243:23)
    TapParser.parse (node:internal/test_runner/tap_parser:103:24)
    TapParser._transform (node:internal/test_runner/tap_parser:181:10)
    Transform._write (node:internal/streams/transform:175:8)
    writeOrBuffer (node:internal/streams/writable:392:12)
    _write (node:internal/streams/writable:333:10)
    Writable.write (node:internal/streams/writable:337:10)
  ...
1..1
# tests 1
# pass 0
# fail 1
# cancelled 0
# skipped 0
# todo 0
# duration_ms 75.363203

It does not work with the latest available version (19.6.0)

v19.6.0
TAP version 13
# Subtest: [redacted]/tmp/main.js
    # <Buffer >
not ok 1 - [redacted]/tmp/main.js
  ---
  duration_ms: 62.524259
  failureType: 'uncaughtException'
  error: "Cannot read properties of undefined (reading 'value')"
  code: 'ERR_TEST_FAILURE'
  stack: |-
    #Plan (node:internal/test_runner/tap_parser:651:20)
    #TAPDocument (node:internal/test_runner/tap_parser:550:28)
    #parseChunk (node:internal/test_runner/tap_parser:274:35)
    #parseTokens (node:internal/test_runner/tap_parser:249:23)
    TapParser.parse (node:internal/test_runner/tap_parser:105:24)
    TapParser._transform (node:internal/test_runner/tap_parser:187:10)
    Transform._write (node:internal/streams/transform:175:8)
    writeOrBuffer (node:internal/streams/writable:392:12)
    _write (node:internal/streams/writable:333:10)
    Writable.write (node:internal/streams/writable:337:10)
  ...
1..1
# tests 1
# pass 0
# fail 1
# cancelled 0
# skipped 0
# todo 0
# duration_ms 71.162296

Additional information

The following script works with all tested version (19.1.0, 19.2.0 & 19.6.0) when not using the --test flag:

const { readFile } = require("node:fs/promises");

(async () => {
  const buffer = await readFile("./test.txt");
  console.log(buffer);
  console.log(buffer.byteLength);
})()
@MoLow MoLow added the test_runner Issues and PRs related to the test runner subsystem. label Feb 5, 2023
@MoLow
Copy link
Member

MoLow commented Feb 5, 2023

this is probably a duplicate of #45706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants