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

TAP event output: plan is miscounted #46899

Closed
SRHerzog opened this issue Mar 1, 2023 · 1 comment
Closed

TAP event output: plan is miscounted #46899

SRHerzog opened this issue Mar 1, 2023 · 1 comment

Comments

@SRHerzog
Copy link
Contributor

SRHerzog commented Mar 1, 2023

Version

19.7.0

Platform

Darwin SHerzog-USMAC22.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 arm64

Subsystem

test_runner

What steps will reproduce the bug?

These files are copied from the internal test fixtures:

// test/fixtures/test-runner/custom_reporters/custom.js
const assert = require('assert');
const path = require('path');

module.exports = async function * customReporter(source) {
  const counters = {};
  for await (const event of source) {
    // removed assert from original fixture
    counters[event.type] = (counters[event.type] ?? 0) + 1;
  }
  yield "custom.js ";
  yield JSON.stringify(counters);
};
// test/fixtures/test-runner/reporters.js
'use strict';
const test = require('node:test');

test('nested', { concurrency: 4 }, async (t) => {
  t.test('ok', () => {});
  t.test('failing', () => {
    throw new Error('error');
  });
});

test('top level', () => {});

Run node --test-reporter=./custom.js ./reporters.js.

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

Reproduces consistently.

What is the expected behavior?

The number of "plan" events should be at least as many as the number of tests started. In this case, I would expect the output to be custom.js {"test:start":4,"test:pass":2,"test:fail":2,"test:plan":4,"test:diagnostic":7}

What do you see instead?

custom.js {"test:start":4,"test:pass":2,"test:fail":2,"test:plan":2,"test:diagnostic":7}

Additional information

This behavior may be intertwined with #46762

@SRHerzog
Copy link
Contributor Author

SRHerzog commented Mar 1, 2023

Had some mistaken assumptions, please disregard.

@SRHerzog SRHerzog closed this as completed Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant