lib/format/markdown.js
function tryExit(state, depth) {
  while (state.depth >= depth) {
    state.suiteStack.pop();
    state.currentSuite = state.suiteStack[state.suiteStack.length - 1];
    state.currentSnapshotList = null;
    state.depth--;
  }
}
function tryExit(state, depth) {
  while (state.depth >= depth) {
    state.suiteStack.pop();
    state.currentSuite = state.suiteStack[state.suiteStack.length - 1];
    state.currentSnapshotList = null;
    state.depth--;
  }
}
tryExit tries to pop state until it has correct depth.

@param {SerializerState} state Current state.
@param {number} depth Current depth.