Sitelet https://github.com/nodejs/node/issues/50176
Skip to content

impossible to use spec test reporter without new #50176

Description

@mcollina

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

Activity

  1. added
    test_runnerIssues and PRs related to the test runner subsystem.
    confirmed-bugIssues and PRs for confirmed bugs.
    on Oct 13, 2023
  2. pluris commented on Oct 13, 2023

    @pluris
    Contributor

    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)

  3. himself65 commented on Oct 13, 2023

    @himself65
    Member

    I'd like to work on this

  4. himself65 commented on Oct 13, 2023

    @himself65
    Member

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

  5. aduh95 commented on Oct 13, 2023

    @aduh95
    Contributor

    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.

  6. mcollina commented on Oct 14, 2023

    @mcollina
    SponsorMemberAuthor

    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.

  7. himself65 commented on Oct 14, 2023

    @himself65
    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

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

    confirmed-bugIssues and PRs for confirmed bugs.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