Repository navigation
Testing & Debugging
wrathtafarian edited this page Apr 7, 2025
·
1 revision
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.
Here are some tools and techniques to help debug common issues:
Most apps support a verbose or debug flag:
node app.js --debug
# or
python app.py --debugOr set a debug environment variable:
export DEBUG=trueUse the following commands to run the project’s test suite:
npm testpytestBe sure to refer to the specific test runner or tool used in your stack (e.g., go test, cargo test, etc.).
For test runners that support watch mode:
npm test -- --watch
# or
pytest --lf --maxfail=1 --disable-warningsThis helps speed up the dev/test cycle by rerunning only the most recent or failed tests.
- 🔧 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 --coverageorcoverage.py
| 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
|
If you’re stuck, open an issue on GitHub or start a discussion.