epam-short-track

Node.js and Testing cross interview #6

Node.js Basics:

  1. What is Node.js, and how does it differ from regular JavaScript?
  2. What is the purpose of the package.json file, and how does it differ from package-lock.json?
  3. What is the difference between devDependencies and dependencies in NPM?
  4. How do CommonJS (require) and ES Modules (import) differ in Node.js?
  5. What is the fs module, and how do you perform asynchronous file operations with it?
  6. Briefly explain what streams are in Node.js and describe their types.
  7. What is the difference between path.join and path.resolve, and when would you use each?
  8. How do environment variables work in Node.js, and how are they used in applications?
  9. How does Node.js handle errors, and what are common patterns for error handling?
  10. What is the global object in Node.js, and how does it differ from the browser’s global object?

Testing:

  1. What is the purpose of unit testing?
  2. What is integration testing, and what are its main goals?
  3. How does unit testing differ from integration testing?
  4. What is end-to-end (E2E) testing, and when should it be used?
  5. How does E2E testing differ from integration testing?
  6. What is the testing pyramid, and why is it a useful concept in software testing?
  7. Explain the principles of the FIRST (Fast, Independent, Repeatable, Self-validating, Timely) acronym in testing.
  8. What is test-driven development (TDD), and how does it improve software quality?
  9. What is code coverage, and what are its limitations despite having a high percentage?
  10. Explain the Arrange-Act-Assert (AAA) pattern and its importance in writing unit tests.
  11. How does Jest facilitate testing in JavaScript? Provide an example of a simple test.
  12. What are snapshot tests in Jest, and when should you use them?
  13. What is mocking, and how does it help isolate dependencies in tests?
  14. What are stubs in the context of testing, and how do they differ from mocks?
  15. What are spies in the context of testing, and what is their purpose?
  16. What is the difference between mocks, stubs, and spies in the context of testing?
  17. What are flaky tests?
  18. What are some best practices for organizing test files and test suites?
  19. How can you use environment variables to configure test environments in Node.js?
  20. What are best practices for managing environment variables in Node.js testing environments?