Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created June 21, 2020 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/e4cd8a418372e5a15235e33347de8d06 to your computer and use it in GitHub Desktop.
Save isaacs/e4cd8a418372e5a15235e33347de8d06 to your computer and use it in GitHub Desktop.
const Parser = require('tap-parser')
const print = parser => {
parser.on('assert', a => console.log(parser.name, a))
parser.on('complete', res => console.log(parser.name, res))
parser.on('child', c => print(c))
}
const p = new Parser()
print(p)
const tap = `TAP version 13
ok 1 - ./test/simple-bdd.test.js # time=587.364ms {
ok 1 - TOP LEVEL # time=33.498ms {
ok 1 - GROUPED subject1 # time=9.966ms {
ok 1 - CONTEXT WHEN INITIAL CONDITIONAL IS TRUE # time=6.642ms {
ok 1 - A TEST for subject1 # time=0.821ms {
ok 1 - some assertion
1..1
}
1..1
}
1..1
}
ok 2 - GROUPED subject2 # time=6.689ms {
ok 1 - CONTEXT WHEN INITIAL CONDITIONAL IS TRUE # time=3.506ms {
ok 1 - A TEST for subject2 # time=0.058ms {
1..0
}
1..1
}
1..1
}
ok 3 - GROUPED subject3 # time=6.083ms {
ok 1 - CONTEXT WHEN INITIAL CONDITIONAL IS TRUE # time=3.056ms {
ok 1 - A TEST for subject3 # time=0.042ms {
1..0
}
1..1
}
1..1
}
1..3
}
1..1
# time=37.706ms
}
1..1
# time=605.075ms
`
p.end(tap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment