This example demonstrates common debugging scenarios in frontend JavaScript, specifically focusing on user list rendering with intentional bugs and their solutions.
userList.js- demonstrate an error caused by an index out of bounds issue — run theuserList.test.jsunittest to seetaskManager.js- demonstrate error due to a global variable being overwritten - runtaskManager.test.jsunittest to see
- Node.js 14.x or higher
- A modern web browser with developer tools
- Basic understanding of DOM manipulation
-
Install dependencies:
npm install -
Run the application:
npm start
To run all tests:
npm test
To run individual tests:
npx jest tests/userList.test.js
npx jest tests/taskManager.test.js
You can also run tests with a specific pattern:
npx jest --testNamePattern="loadDashboard should render user list correctly"