-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathnode_tap_snapshots.javascript.txt
30 lines (21 loc) · 1.46 KB
/
node_tap_snapshots.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
┏━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ NODE_TAP_SNAPSHOTS ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━┛
ALTERNATIVES ==> #See Jest snapshots
VERSION ==> #Part of node-tap (see its doc)
┌────────────────┐
│ ASSERTIONS │
└────────────────┘
TEST.matchSnapshot(VAL, 'NAME') #Asserts against snapshot
TEST.resolveMatchSnapshot
(VAL_PROMISE[()], 'NAME') #Same but async
TEST.formatSnapshot(VAL)->STR #Customize function to stringify non-STR VALs (def: tcompare library)
#If return non-STR, use default on it.
TEST.cleanSnapshot(STR)->STR2 #Customize function to normalize stringified VALs before comparison (def: nothing)
┌───────────┐
│ FILES │
└───────────┘
./tap-snapshots/FILE-TAP.test.js #Snapshot files
#Are module.exports['FILE TAP > NAME NUM'] = STR
ENVVAR TAP_SNAPSHOT=1
--snapshot|S #Write snapshots