Testing
Test Suites
| Suite |
File |
Tests |
CDP Required |
What It Tests |
| E2E |
tests/e2e.test.js |
70+ |
Yes |
All MCP tools against live TradingView |
| Pine Analysis |
tests/pine_analyze.test.js |
15 |
No |
Offline static analysis (array bounds, bad loops) |
| CLI |
tests/cli.test.js |
10 |
No |
Command routing, help output |
| Replay |
tests/replay.test.js |
5 |
Yes |
Replay state transitions |
| Sanitization |
tests/sanitization.test.js |
5 |
No |
safeString, requireFinite |
Running Tests
cd tradingview-mcp
# Offline tests only (no TradingView needed)
npm test
# E2E tests (TradingView must be running with CDP)
npm run test:e2e
# All tests with verbose output
npm run test:all -- --verbose
# Single test file
node --test tests/pine_analyze.test.js
Test Coverage Gaps
- No unit tests for
connection.js (reconnect logic)
- No tests for
trading.js (UI automation is hard to test)
- No error path tests (CDP disconnect mid-operation)
- No performance tests (rapid tool calls)
- No dashboard tests (no framework to test against)