Testing in software development is a crucial process aimed at ensuring the quality, functionality, and reliability of software applications. It involves executing software with the intent of identifying errors, gaps, or missing requirements compared to the desired outcomes. The process of software testing can be broadly categorized into several key types, each serving a specific purpose within the development lifecycle
- Initialize your project
npm init
- Install Vitest as a development dependency
npm i -D vitest
- Add the test command to your package.json
scripts: { ... "test": "vitest" }
- Run your tests in watch mode
npm run test
- Install @vitest/ui
npm i -D @vitest/ui
- Add test:ui command to package.json
scripts: { ... "test:ui": "vitest --ui" }
- Run the test:ui command
npm run test:ui
- Add the command to package.json
scripts: { ... "coverage": "vitest run --coverage" }
- Run the coverage command and install the dependencies
npm run coverage
- Re-run the command
npm run coverage
- Go to the generated
coverage
directory - Open your
index.html
file (recommended extension - LiveServer)