Skip to content

[Tracking issue] Converting tests to use Countdown #17169

Closed
@jasnell

Description

@jasnell

One possible set of tasks that I can suggest for new contributors who are bit more confident in their Node.js skills, would be converting tests to use the new ../common/countdown utility module.

For instance, if you take a look at: https://github.com/nodejs/node/blob/master/test/parallel/test-http2-client-destroy.js, you'll see that there is a remaining counter (https://github.com/nodejs/node/blob/master/test/parallel/test-http2-client-destroy.js#L19). The test then counts down remaining before closing the server. There are quite a large number of tests in our suite that perform similar actions in ways that are rather inconsistent. The ../common/countdown utility was designed to bring some consistency there.

The way the Countdown utility works is straightforward:

const common = require('../common');
const Countdown = require('../common/countdown');

// ...

const countdown = new Countdown(n, common.mustCall(() => {
  // do something here
}));

// Decrement the counter, the callback is called synchronously when
// countdown.dec is called n times.
countdown.dec();

I know that there are quite a few of the http2 tests that can benefit from this, along with a bunch of other http and https tests.

These tasks would be for folks who are a bit more comfortable with their Node.js skills.

There are many tests in the suite that could be modified to use this new utility. However, rather than modifying them all at once, if a new contributor wishes to take this on, please one change one or two at a time, leaving other tests for other contributors to pick up on. Just reference this tracking issue in the commit/PR so that we can keep track.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.testIssues and PRs related to the tests.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions