Explore Library
TypeScriptTesting & Type Testing in TypeScript

65 items

1

Naive Equals Type Helper

Code Quiz
2

Typing Mock Functions

Flashcard
3

Typing Test Fixtures and Mock Data

Slides / Video
4

Testing Utility and Generic Types

Slides / Video
5

Testing Async Code with Typed Promises

Slides / Video
6

Typing Assertion Libraries and Custom Matchers

Slides / Video
7

Type Coverage Tools

Slides / Video
8

The @ts-expect-error Directive

Slides / Video
9

Type Testing with dtslint & expect-type

Slides / Video
10

Type Testing with tsd

Slides / Video
11

Asserting Types with expectTypeOf

Slides / Video
12

What Type Testing Is

Slides / Video
13

Runtime vs Compile-time Test Verification

Slides / Video
14

Mocking Modules with Type Safety

Slides / Video
15

Typing Mocks with jest.Mocked

Slides / Video
16

Writing Typed Unit Tests

Slides / Video
17

Configuring tsconfig for Test Environments

Slides / Video
18

Setting Up Vitest for TypeScript

Slides / Video
19

Setting Up Jest with ts-jest

Slides / Video
20

Why TypeScript Testing Differs

Slides / Video
21

Type Tests vs Runtime Tests

Quiz
22

dtslint for Declaration Testing

Quiz
23

Type-Safe Spies and Partial Mocks

Quiz
24

Testing never and any Behaviors

Quiz
25

Testing Function Return Types

Quiz
26

Assignability vs Exact Equality

Quiz
27

Exact Type Equality Check

Quiz
28

Vitest expectTypeOf API

Quiz
29

expect-type Assertions

Quiz
30

tsd Type Testing Library

Quiz
31

Expect/Equal Helper Types

Quiz
32

Typing Assertion Libraries

Quiz
33

@types Packages for Test Frameworks

Quiz
34

Typing Test Fixtures and Helpers

Quiz
35

Typing Mocks with jest.Mocked

Quiz
36

Testing Conditional & Mapped Types

Quiz
37

Testing Function Parameter Types

Quiz
38

Typing a Promise-Returning Mock

Code Quiz
39

Exhaustiveness never Assertion

Code Quiz
40

Negative Type Test With ts-ignore

Code Quiz
41

Type Check Instead of Runtime Test

Code Quiz
42

Factory Spread Override Order

Code Quiz
43

jest.Mocked Without jest.mock

Code Quiz
44

jest.fn Generic Return Type

Code Quiz
45

toBe vs toEqual on Objects

Code Quiz
46

Awaiting Async Promise Assertions

Code Quiz
47

ReturnType Given a Value

Code Quiz
48

Uncalled expectTypeOf Matcher

Code Quiz
49

Reversed Assignability Check

Code Quiz
50

expectError on a Valid Call

Code Quiz
51

expectType with tsd Assertions

Code Quiz
52

Unused @ts-expect-error Directive

Code Quiz
53

Typed Spies and jest.Mocked<T>

Flashcard
54

Organizing Tests in .test-d.ts Files

Flashcard
55

dtslint for Declaration File Testing

Flashcard
56

expect-type Library Assertions

Flashcard
57

Type-Safe Test Fixtures and Factories

Flashcard
58

Runtime vs Type-Level Testing

Flashcard
59

Assignability vs Exact Equality

Flashcard
60

The tsd Library

Flashcard
61

Typing Custom Matchers/Assertions

Flashcard
62

Typing Setup and Teardown Hooks

Flashcard
63

Typing Test Assertions in Jest/Vitest

Flashcard
64

Type-Level Equality Assertions

Flashcard
65

Testing Compile Errors as Expected

Flashcard
FlashcardIntermediate

Typing Setup and Teardown Hooks

Setup/teardown hooks share typed state across tests when handled carefully.

Question

How do you keep shared state type-safe across beforeEach/afterEach hooks?

Click to reveal answer