nodejs / nodejs/node

`node:test` Tests without callback should not be reported as ok

未关闭
#65,563 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
122k
派生
37.3k
平均合并
4 天 2 小时
30 天内合并 PR
283

描述

Version

26.7.0

Platform

Subsystem

No response

What steps will reproduce the bug?
describe('two todos', () => {
  // TODO
  it('should handle first case', (t) => {
    t.todo();
  });

  // TODO
  it('should handle second case');
});

This would report as

ℹ tests 2
ℹ suites 1
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 1
How often does it reproduce? Is there a required condition?

Deterministic

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

A test with no body, thus that doesn't test anything, should not be reported as OK.

It usually indicates a test that's TODO, so the existing feature of reporting todos may be the most relevant option there, and I think (?) it would be non-breaking for existing test suites.

What do you see instead?

TODO/incomplete test reported as pass

Additional information

Hi there 👋

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,在 Node.js 26.7.0 上使用提供的 node:test describe/it 示例重现问题,然后追踪 node:test 实现及其测试中如何对没有回调的测试进行分类。完成标准是:空测试不再被报告为 pass,并且按照预期的 todo 行为进行一致分类,同时保留现有的测试报告。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, node.js
领域
testing-qa
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。