本文整理汇总了TypeScript中test/lib/common.it.only方法的典型用法代码示例。如果您正苦于以下问题:TypeScript it.only方法的具体用法?TypeScript it.only怎么用?TypeScript it.only使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test/lib/common.it
的用法示例。
在下文中一共展示了it.only方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('given 2 subscribers', () => {
it('should notfiy subscribers', () => {
var events = new Emitter();
var sub1Called = false;
var sub2Called = false;
events.on('test', () => {
sub1Called = true;
});
events.on('test', () => {
sub2Called = true;
});
events.emit('test', null);
expect(sub1Called).to.be(true);
expect(sub2Called).to.be(true);
});
it.only('should handle errors', () => {
var events = new Emitter();
var sub1Called = 0;
var sub2Called = 0;
events.on('test', () => {
sub1Called++;
throw "hello";
});
events.on('test', () => {
sub2Called++;
});
try { events.emit('test', null); } catch (_) { }
try { events.emit('test', null); } catch (_) {}
expect(sub1Called).to.be(2);
expect(sub2Called).to.be(0);
});
});