Testing & Debugging - wrathtafarian/js-charts GitHub Wiki

πŸ§ͺ Testing & Debugging

This page provides guidance on how to test and debug js-charts effectively.

πŸ’‘ Whether you're writing new features or troubleshooting issues, these tools and commands will help ensure your project runs smoothly.


πŸ” Debugging Tips

Here are some tools and techniques to help debug common issues:

πŸ“œ Enable Verbose Logging

Most apps support a verbose or debug flag:

node app.js --debug
# or
python app.py --debug

Or set a debug environment variable:

export DEBUG=true

βœ… Running Tests

Use the following commands to run the project’s test suite:

Node.js (Jest, Mocha, etc.)

npm test

Python (pytest)

pytest

Other Frameworks

Be sure to refer to the specific test runner or tool used in your stack (e.g., go test, cargo test, etc.).


πŸ” Watch Mode (Optional)

For test runners that support watch mode:

npm test -- --watch
# or
pytest --lf --maxfail=1 --disable-warnings

This helps speed up the dev/test cycle by rerunning only the most recent or failed tests.


πŸ›  Tools You Can Use

  • πŸ”§ VS Code Debugger β€” set breakpoints and step through code
  • πŸ”₯ Console Logging β€” use console.log() or print() to trace flow
  • πŸ§ͺ Test Coverage β€” identify untested code with tools like jest --coverage or coverage.py

🧹 Common Issues & Fixes

Issue Fix
❌ Tests failing due to missing env vars Double-check your .env file or use mocks
❌ Module not found Run npm install or pip install -r requirements.txt
❌ Port already in use Change the port in your .env or config file
🐒 Tests are slow Limit to specific files: pytest tests/unit/ or npm test -- my-file.test.js

πŸ“„ Related Docs


πŸ™‹ Need Help?

If you’re stuck, open an issue on GitHub or start a discussion.