Search⌘ K
AI Features

Appendix: Test-Driven Development

Explore the steps to set up Test-Driven Development (TDD) using Jest in a TypeScript environment. Learn how to initialize an npm project, install Jest and ts-jest, configure testing tools, and manage libraries like jsdom and jQuery. This lesson helps you understand testing strategies, mock functions, and employing Jest effectively for TypeScript testing.

Installing Jest

Jest is available through npm, and will therefore require an npm environment, which can be created as follows:

npm init

Here, we have initialized an npm project and can now install the required Jest packages as follows:

npm install jest --save-dev
...