【发布时间】:2022-07-14 01:38:37
【问题描述】:
虽然this SO article 介绍了如何在 javascript 中跳过测试。讨论不包括如何在 TypeScript 中做同样的事情。
无效代码示例:
describe.only('Example test suite',() => {
before(async () => {
if(true) {
console.log('Unexpected condition. Test results may be invalid. Skipping tests.');
this.skip();
}
});
it('it will do something',async () => {
console.log('This should not run.');
});
});
结果:
error TS2532: Object is possibly 'undefined'.
【问题讨论】:
标签: typescript testing mocha.js skip