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

impossible to use spec test reporter without new #50176

Closed
mcollina opened this issue Oct 13, 2023 · 6 comments
Closed

impossible to use spec test reporter without new #50176

mcollina opened this issue Oct 13, 2023 · 6 comments
Labels
confirmed-bug Issues with confirmed bugs. test_runner Issues and PRs related to the test runner subsystem.

Comments

@mcollina
Copy link
Member

mcollina commented Oct 13, 2023

Version

v18.18.1 and v20.8.0

Platform

all

Subsystem

node:test

What steps will reproduce the bug?

const { spec } = require('node:test/reporters');
const { run } = require('node:test');
const path = require('node:path');

run({ files: [path.resolve('./tests/test.js')] })
  .compose(spec)
  .pipe(process.stdout);

Nothing gets printed.

Instead, the following works:

const { spec } = require('node:test/reporters');
const { run } = require('node:test');
const path = require('node:path');

run({ files: [path.resolve('./tests/test.js')] })
  .compose(new spec)
  .pipe(process.stdout);

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

all the time.

What is the expected behavior? Why is that the expected behavior?

No response

What do you see instead?

No output without new

Additional information

No response

@mcollina mcollina added test_runner Issues and PRs related to the test runner subsystem. confirmed-bug Issues with confirmed bugs. labels Oct 13, 2023
@pluris
Copy link
Contributor

pluris commented Oct 13, 2023

Hello, I have a question.
Should both work(new spec, spec)? Or should only spec work?
Currently, new spec and spec() work, but spec does not work.
I would like to ask if it should work the same way as tap and dot.

While looking for related content, I found that there was an issue that the behavior was different before. (#48112)

@himself65
Copy link
Member

I'd like to work on this

@himself65
Copy link
Member

I think the reason is spec is a class, but others are *function

@aduh95
Copy link
Contributor

aduh95 commented Oct 13, 2023

I'm not sure this is a bug, you need to call the function, i.e. .compose(spec()). FWIW when using the new keyboard, you are calling the function as a constructor, which is supported but it's no longer necessary since #49184 has landed.

@mcollina
Copy link
Member Author

I'm not sure this is a bug, you need to call the function, i.e. .compose(spec()). FWIW when using the new keyboard, you are calling the function as a constructor, which is supported but it's no longer necessary since #49184 has landed.

It's a bug in the form of anything you said is not documented. The only documented thing is .compose(tap), which is incorrect.

@himself65
Copy link
Member

const { value, write, final, destroy } = fromAsyncGen(body);

The error starts from here, body is class SpecReporter, but nodejs treats it as a async generator

targos pushed a commit that referenced this issue Oct 23, 2023
PR-URL: #50187
Fixes: #50176
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
alexfernandez pushed a commit to alexfernandez/node that referenced this issue Nov 1, 2023
PR-URL: nodejs#50187
Fixes: nodejs#50176
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this issue Nov 11, 2023
PR-URL: #50187
Fixes: #50176
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
4 participants