This document provides instructions for testing the application, running test cases, and generating reports.
- Essential Requirements
- Running Test Cases
- Jest Tests
- BDD Tests
- Generating Reports
- Jest Coverage Report
- CodeQL Report
- Deployment
-
Node.js and npm: Ensure Node.js and npm are installed. Verify by running
node -vandnpm -vin your terminal. -
Project Dependencies:
- Navigate to the
serverdirectory:cd server - Run:
npm install - Navigate to the
clientdirectory:cd client - Run:
npm install
- Navigate to the
-
CodeQL CLI: Download the CodeQL CLI from https://github.com/github/codeql-action/releases and extract it to the project root.
-
Environment Variables:
- Create a
.envfile in theserverdirectory. - Generate a secret key:
node -e console.log(require('crypto').randomBytes(64).toString('hex')) - Add to
.env:SECRET_KEY=<your_generated_key>
- Create a
-
Jest Tests:
- Navigate to the
serverdirectory:cd server - Run:
npx jest --runInBand tests/
- Navigate to the
-
BDD Tests:
- Start the application (both server and client using
npm start). - In a new terminal, navigate to
clientand run:npx cypress open
Note: To run
rateLimiter.feature:- In
server/server.ts, change line 72 to5. - Restart the server.
- Run the
rateLimiter.featurefile in Cypress.
- Start the application (both server and client using
-
Jest Coverage Report:
- Navigate to the
serverdirectory:cd server - Run:
npx jest --collectCoverage tests/ - A document explaining test coverage exclusions is available [here]. (Replace "[here]" with the actual link)
- Navigate to the
-
CodeQL Report:
- Create a
codeql-dbsdirectory in the project root. - Generate a CodeQL database:
codeql/codeql database create codeql-dbs/final-project-shrusti-nihar-db --language=typescript -s server - Analyze the database:
codeql/codeql database analyze codeql-dbs/final-project-shrusti-nihar-db --format=sarifv2.1.0 -o results.sarif --rerun - View the
results.sarifreport using an online SARIF viewer.
- Create a
The link to Render is: https://final-project-render-shrushti-nihar.onrender.com