A sample project to demonstrate the refactoring of a set of codebase to pattern.
- Simplification
- Generalization
- Init project config (package.json)
npm init -y
# using -y flag tells npm init to automatically use the defaults.- Install TypeScript and ts-node
npm i -D typescript ts-node
# This will add the package under devDependencies- Create a tsconfig.json file
# Will create the tsconfig.json file with default options
npx tsc --init- Configuring Testing Environment
npm i -D jest ts-jest @types/jest- Configure Jest:
jest.config.jsmodule.exports = { preset: "ts-jest", testEnvironment: "node", };
- Add TypeScript Configuration: Add
includeandexcludeproperties aftercompilerOptions{ "compilerOptions": { // ... }, "include": ["**/*.ts"], "exclude": ["node_modules"] }