-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
@mfedderly and @smallsaucepan you've mentioned a couple of times that it would be useful to have some better debug visualization tooling. I felt the same thing and have started banging out an MVP of something that might help.
What I had in mind was the following:
- A hook script that can be
--imported into anything run with tsx (and compiled to be imported in node). The hook script:- Provides the entire
turflibrary and aDebugVizglobal with some convenient functions to exfiltrate debug data. - Can be referenced either from the file under test or the console in a debugger.
- Completely synchronous, so doesn't have to wait for next tick in the debugger to send a message
- Provides the entire
- A super basic web socket relay server that forwards messages from the hook script to the front end.
- A mapbox-driven visualizer front-end that receives messages from the hook that contain geojson data and displays them, with some ability to play around with the map.
The main functions to get data out of the system under test would be:
DebugViz.send(geojson: GeoJSON, label?: string)DebugViz.diff(geojson1: GeoJSON, geojson2: GeoJSON, label?: string)
Then the front end would have some different view options including a diff mode to see the GeoJSON.
Workflow would be:
- Start the server
- If desired can put a
/// <reference...in the file you are playing with to get typing on the hook - Add debug viz statements into the test (e.g.,
DebugViz.diff(result, expectedOutput). - Run a test with the hook (this is what I've been doing):
npx tsx --import ../../../turf-debug-viz/src/debug-hook.ts test.ts - Explore in the visualizer
- If doing something thorny can just send any in-scope variable from a breakpoint in the debugger, can also send reruns from different branches, etc.
Example screenshot of the very first version is below. This something you would be interested in?

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels