跳过测试
🌐 Skipping tests
可以通过向测试传递 skip 选项,或调用测试上下文的 skip() 方法来跳过单个测试。这两种方法都支持包含一条消息,该消息会在 TAP 输出中显示,如以下示例所示。
🌐 Individual tests can be skipped by passing the skip option to the test, or by
calling the test context's skip() method. Both of these options support
including a message that is displayed in the TAP output as shown in the
following example.
// The skip option is used, but no message is provided.
test('skip option', { skip: true }, (t) => {
// This code is never executed.
});
// The skip option is used, and a message is provided.
test('skip option with message', { skip: 'this is skipped' }, (t) => {
// This code is never executed.
});
test('skip() method', (t) => {
// Make sure to return here as well if the test contains additional logic.
t.skip();
});
test('skip() method with message', (t) => {
// Make sure to return here as well if the test contains additional logic.
t.skip('this is skipped');
});