Testing and Debugging Interview Questions for Full Stack with Node.js
22 Testing and Debugging questions with answers for full stack with node.js roles — 7 easy, 8 medium, 7 hard.
About Testing and Debugging
Write unit and integration tests with Jest, Supertest and the built-in node test runner, mock dependencies and run tests against real databases in CI. Debug with the inspector, profile CPU and memory, add structured logging with correlation IDs, handle flaky tests, and learn contract testing and load testing before high-traffic events.
Write a Jest unit test for a function that calculates order total with GST.
Show answer
How do you debug a Node.js application?
Show answer
Why is structured logging important and which libraries are used?
Show answer
What is code coverage and is 100 percent coverage a good goal?
Show answer
A new developer pushes code that breaks the login API in staging. How would you prevent this in future?
Show answer
How do you handle a situation where you cannot find the root cause of a bug before a deadline?
Show answer
How do you test Express routes with Supertest?
Show answer
How do you mock a database or external service in Jest?
Show answer
What is the built-in node:test runner and when would you use it over Jest?
Show answer
How do you run integration tests against a real database in CI?
Show answer
A test passes locally but fails randomly in CI. How do you approach this flaky test?
Show answer
How would you test code that depends on the current time, like an expiring coupon?
Show answer
Tell me about a production incident you handled and what you did after it.
Show answer
Describe how you would mentor a junior developer who writes no tests.
Show answer
How do you add a correlation ID to every log line for a request?
Show answer
Production shows intermittent 502 errors from the load balancer but your app logs show nothing. How do you investigate?
Show answer
How do you find which function is using the most CPU in a Node.js service?
Show answer
What is contract testing and why is it useful for microservices?
Show answer
How do you load test a Node.js API before a big sale event?
Show answer
A regex in your validation code makes the server hang on certain inputs. What is the issue?
Show answer
After a Node.js version upgrade, a few integration tests fail with date and crypto differences. How do you handle the upgrade safely?
Show answer
Frequently asked questions
How important is Testing and Debugging in Full Stack with Node.js interviews?
Write unit and integration tests with Jest, Supertest and the built-in node test runner, mock dependencies and run tests against real databases in CI. Debug with the inspector, profile CPU and memory, add structured logging with correlation IDs, handle flaky tests, and learn contract testing and load testing before high-traffic events.
How should I use the Testing and Debugging sheet?
Go top to bottom — easy to hard. Answer before opening each answer, tick what you solved and save misses to Last-Minute Revision.