From 7ae2eba53391edc454d0f75a2f04ad7db5475434 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 21 Jan 2018 19:29:28 -0800 Subject: [PATCH] Allowed functions in jest's describe As of 22.0.5, jest allows classes for describe blocks. --- types/jest/index.d.ts | 2 +- types/jest/jest-tests.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 0ba1762485..669a96fa23 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -220,7 +220,7 @@ declare namespace jest { } interface Describe { - (name: string, fn: EmptyFunction): void; + (name: string | Function, fn: EmptyFunction): void; only: Describe; skip: Describe; } diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 4d8ae05e1c..146c848a72 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -10,6 +10,10 @@ declare const $: any; // Tests based on the Jest website jest.unmock('../sum'); +class TestClass { } + +describe(TestClass, () => { }); + describe('sum', () => { it('adds 1 + 2 to equal 3', () => { const sum: (a: number, b: number) => number = require('../sum');