我一直在使用 Test Cafe 编写一个内部测试框架,其中操作 (t.click) 和断言 (t.expect) 不是直接写在规范中,而是在其他文件中定义和聚合。
一切都很酷,直到测试不失败:在这种情况下,Test Cafe 记者在控制台中写入了断言/操作失败和相关代码片段,但我没有找到理解测试中函数调用的完整堆栈跟踪的方法归结为失败的断言。
我怎样才能确保在报告器中提供完整的堆栈跟踪,记录所有导致我的测试失败的函数调用的堆栈跟踪?
我知道原因应该与async/await如何转换为生成器有关:错误的堆栈跟踪仅显示最后执行的 await 而不是所有先前的调用。
<section> ... </section>
<section class="section--modifier">
<h1> ... </h1>
<div>
...
<button class="section__button">
<div class="button__label">
<span class="label__text">Hello!</span> <-- Target of my test
</div>
</button>
...
</div>
</section>
<section> ... </section>
Run Code Online (Sandbox Code Playgroud)
//
// My spec file
//
import { Selector } from 'testcafe';
import {
verifyButtonColor
} from './button';
fixture`My Fixture`
.page`....`;
test('Test my section', async (t) => {
const MySection = Selector('.section--modifier'); …Run Code Online (Sandbox Code Playgroud)