-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtap-out.javascript.txt
61 lines (49 loc) · 3.01 KB
/
tap-out.javascript.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
┏━━━━━━━━━━━━━┓
┃ TAP-OUT ┃
┗━━━━━━━━━━━━━┛
ALTERNATIVES ==> #See tap-parser
VERSION ==> #2.0.0
┌─────────┐
│ RUN │
└─────────┘
new TAP-OUT.Parser() #EVENTEMITTER
PARSER.handleLine(STR) #Fills PARSER.results and emit events
TAP-OUT([FUNC(ERROR, RESULTS)]) #IOSTREAM that calls PARSER.handleLine() on each line, and outputs RESULTS
->IOSTREAM #Events from PARSER are emitted on IOSTREAM
PARSER.results #RESULTS
RESULTS.asserts|pass|fail|results|
tests|versions|plans|comments #TOKEN_ARR
RESULTS.errors #'ERROR'_ARR on plan error
#Only when called through TAP-OUT() (not TAP-OUT.Parser())
tap-out #Same as CLI, using stdin|stderr
┌────────────┐
│ TOKENS │
└────────────┘
TOKEN #Any of the types below
TOKEN.type #'version|plan|assert|result|test|comment'
TOKEN.raw #Line as STR
PARSER.on('version',FUNC(VERSION))#TAP version line. VERSION has no other properties than TOKEN
PARSER.on('plan', FUNC(PLAN)) #PLAN:
# - from|to NUM
# - skip 'COMMENT' (if "# skip COMMENT")
PARSER.on('assert', FUNC(ASSERT)) #Single assertion:
# - ok BOOL
# - number INDEX
# - name 'ASSERT_TITLE'
# - error OBJ (YAML props):
# - raw STR (exclude stack when there is one)
# - VAR: VAL
# - stack STR
# - at: file 'PATH', line|character NUM
# - test TEST_NUM
PARSER.on('pass', FUNC(ASSERT)) #Emitted after 'assert' if ASSERT.ok true
PARSER.on('fail', FUNC(ASSERT)) #Emitted after 'assert' if ASSERT.error defined
PARSER.on('result', FUNC(RESULT)) #Comment # VAR: NUM
# - name 'VAR'
# - count NUM
PARSER.on('test', FUNC(TEST)) #Comment # TEST_TITLE (i.e. any other comment)
# - name 'TEST_TITLE'
# - number TEST_NUM
#It increments TEST_NUM
PARSER.on('comment',FUNC(COMMENT))#Unknown lines (not comment):
# - test TEST_NUM