-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdeno_snapshots.deno.txt
55 lines (40 loc) · 2.73 KB
/
deno_snapshots.deno.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
┏━━━━━━━━━━━━━━━━━━━━┓
┃ DENO_SNAPSHOTS ┃
┗━━━━━━━━━━━━━━━━━━━━┛
ALTERNATIVES ==> #See Jest snapshots
VERSION ==> #Part of Deno test (see its doc)
@std/testing/snapshot #Entrypoint (std library)
┌────────────────┐
│ ASSERTIONS │
└────────────────┘
createAssertSnapshot
(OPTS, assertSnapshot)
->assertSnapshot #Binds OPTS
assertSnapshot(T, VAL[, OPTS])->> #Either assert|update snapshot
OPTS.mode #One of:
R# - 'assert' (def): throw on difference or missing snapshot file
WR# - 'update':
# - ignore difference or missing snapshot file
# - update snapshot file
deno test ... -- --update|-u #Sets OPTS.mode default to 'update'
OPTS.msg #Error 'MESSAGE'
┌───────────┐
│ FILES │
└───────────┘
OPTS.path #'PATH' of the snapshot file.
#Def: '{OPTS.dir}/TEST_FILENAME.snap'
OPTS.dir #'DIR'. Relative to test file.
#Def: '__snapshots__'
OPTS.name #STR. Snapshot name. Def: '[... PARENT_TEST_TITLE >] TEST_TITLE'
#Always appends a NUM incremented at each assertSnapshot() inside test
┌────────────────┐
│ SERIALIZER │
└────────────────┘
SNAPSHOT FILE ==> #Export a snapshot OBJ where key is OPTS.name and value is serialized snapshot
OPTS.serialize #FUNC(VAL)->STR to serialize snapshots. Def: serialize()
serialize(VAL)->STR #Deno.inspect() with OPTS:
# - depth|iterableLimit|strAbbreviateSize Infinity: full OBJ
# - sorted true: stable output
# - compact false
# - trailingComma true
#And \\n -> \n