本文整理汇总了TypeScript中assert.throws函数的典型用法代码示例。如果您正苦于以下问题:TypeScript throws函数的具体用法?TypeScript throws怎么用?TypeScript throws使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了throws函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should not accept a selector to an unknown element as input', function() {
assert.throws(function() {
makeDOMDriver('#nonsenseIdToNothing');
}, /Cannot render into unknown element/);
});
示例2: test
test('throws if bad ++opt name', () => {
assert.throws(() => commandParsers.write('++foo=foo'));
});
示例3: it
it('does not load invalid YAML', () => assert.throws(() => load('petstore-invalid.yaml')));
示例4: ReflectDecorateThrowsIfDecoratorsArgumentNotArrayForFunctionOverload
export function ReflectDecorateThrowsIfDecoratorsArgumentNotArrayForFunctionOverload() {
let target = function() { };
assert.throws(() => Reflect.decorate(undefined, target, undefined, undefined), TypeError);
}
示例5: test
test('register command - no handler', function () {
assert.throws(() => CommandsRegistry.registerCommand('foo', null));
});
示例6: it
it("does not infinite loop on incomplete JSX", () => {
throws(() => transform("const x = <", {transforms: ["jsx"]}));
});
示例7: ReflectDecorateThrowsIfTargetArgumentNotObjectForPropertyOverload
export function ReflectDecorateThrowsIfTargetArgumentNotObjectForPropertyOverload() {
let decorators: (ClassDecorator | MethodDecorator | PropertyDecorator)[] = [];
let target = 1;
let name = "name";
assert.throws(() => Reflect.decorate(decorators, target, name, undefined), TypeError);
}
示例8: it
it('should throw if second argument is not an object', function() {
assert.throws(() => {
(run as any)(() => {}, 'not an object');
}, /Second argument given to Cycle must be an object with driver functions/i);
});
示例9: test
test("try to read lines that don't exist", () => {
assert.equal(vscode.window.activeTextEditor.document.lineCount, 1);
assert.throws(() => TextEditor.readLineAt(1), RangeError);
assert.throws(() => TextEditor.readLineAt(2), RangeError);
});