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()
orprint()
to trace flow - π§ͺ Test Coverage β identify untested code with tools like
jest --coverage
orcoverage.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
- π Installation Guide
- π Project Architecture
- βοΈ Contributing Guide
π Need Help?
If youβre stuck, open an issue on GitHub or start a discussion.