Vanilla Typescript Jest Boilerplate - MIT License

A Code Boilerplate Setup for Vanilla Typescript and Jest for Testing

Getting Started

Clone The Typescript Jest Boilerplate
git clone https://github.com/AshfaqKabir/Typescript-Jest-Boilerplate.git
Go to the project directory
  cd project-folder
Install dependencies
  npm install or yarn
Start Typescript Compiler Globally
 yarn start
Go to src/ create new file substract.ts
export const substract = (x: number, y: number): number => {
  return x - y
}
Create New File substract.test.ts in src/__tests__ directory
import { substract } from "../substract";

describe("test substract function", () => {
  it("should return 5 for substract(10,5)", () => {
    expect(substract(10, 5)).toBe(5);
  });

  it("should return 7 for substract(14,7)", () => {
    expect(substract(14, 7)).toBe(7);
  });
});
Run The Jest Tests
 yarn test

Advanced

To create coverage report
npm run test:coverage or yarn test:coverage
To to build the project
npm run build or yarn build

Author

Follow @AshfaqKabir