JS: add debug statements to the spanning tree