avajs/ava

Fail test even after it has passed

Open

#1,330 建立於 2017年4月1日

在 GitHub 查看
 (4 留言) (2 反應) (0 負責人)JavaScript (20,600 star) (1,408 fork)batch import
blockedenhancementhelp wantedscope:assertionsscope:reportersscope:test-interface

描述

09b23e0d5fd00d48f6b5b1f9c43641faa00f1d1d made it an error if an assertion is added after a test has finished. This can occur if the test finished earlier than the user intended. Once a test has passed though we cannot update its state in the reporters.

The feedback in 09b23e0d5fd00d48f6b5b1f9c43641faa00f1d1d could only be provided to users if the test was waiting for a pending assertion. That behavior itself is confusing, which means that when #1327 is fixed we won't be able to provide any feedback at all.

If a test has passed, but then later an assertion is added before other tests have finished, we should change the test state to a failure and update the reporters. The mini reporter should work well, since it hides previously passing tests. The verbose reporter would have a duplicate entry for the test but perhaps that's OK. I'm not sure whether it's acceptable to add a duplicate entry in the TAP reporter. The alternative is buffering the output for each test file which is not ideal.

貢獻者指南

Fail test even after it has passed · avajs/ava#1330 | Good First Issue