mvelosop / ts-tdd-katas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript Jest boilerplate for TDD katas

This boilerplate uses TypeScript and Jest as testing framework. Test files should are picked based on their name, here's a few examples that will get picked up by Jest:

  • MyClass.test.ts
  • MyJavaScriptModule.test.js
  • MyComponent.test.tsx
  • SubFolder/MyClass.test.ts

You can customize the regexp and jest configuration by editing the package.json file.

UPDATED TO USE

  • pnpm
  • ts-jest

The scripts below should work just as well, replacing npm by pnpm.

TDD Katas

Find the katas catalog in the following link

Happy testing 😊

Installing dependencies

# Get Yarn
npm install -g yarn

# Install dependencies
yarn install

Running tests

# Run tests once
yarn test

# Run tests with Jest-CLI custom arguments (https://jestjs.io/docs/en/cli.html)
yarn test --clearCache --debug

# Run tests for a specific file
yarn test MyFile.test.ts

A few other NPM scripts are provided for convenience, they all support custom arguments as described above.

# Run tests once with coverage
# Coverage report available in ./coverage/index.html
yarn test:cover

# Run all tests in watch mode without coverage
yarn test:watch

# Run the tests with watch mode only for files changed since the last Git commit
yarn test:changed

# Run tests for CI environment (optimized for TravisCI)
yarn test:ci

About


Languages

Language:Shell 44.2%Language:TypeScript 39.5%Language:JavaScript 16.3%