-
Notifications
You must be signed in to change notification settings - Fork 16
/
deno_snapshots.deno.txt
69 lines (46 loc) · 4.04 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
DENO_SNAPSHOTS
ALTERNATIVES ==> #See Jest snapshots
VERSION ==> #Part of Deno test (see its doc)
std/testing/snapshot.ts #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