-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtape_assertions.javascript.txt
83 lines (64 loc) · 4.15 KB
/
tape_assertions.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
┏━━━━━━━━━━━━━━━━━━━━━┓
┃ TAPE_ASSERTIONS ┃
┗━━━━━━━━━━━━━━━━━━━━━┛
ALTERNATIVES ==> #See chai doc
VERSION ==> #Part of Tape (see its doc)
┌────────────┐
│ COMMON │
└────────────┘
EXCEPTIONS ==> #Assertions only report: they do not throw (i.e. control flow continues)
#This helps reporting several failed assertions per test
#However this means following assertions might crash (and exceptions are not handled)
TEST.*(...[, 'ASSERT_TITLE']) #All assertions can specify ASSERT_TITLE as last argument. Def:
# - TEST.fail|pass|skip(): '(unnamed assert)'
# - TEST.error(): ERROR.message
# - others: 'should be ...'
TOPTS.objectPrintDepth #NUM (def: 5)
#When stringifying assertions' expected|actual VAL
NODE_TAPE_OBJECT_PRINT_DEPTH #Same as ENVVAR
┌─────────────┐
│ GENERIC │
└─────────────┘
TEST.fail() #
TEST.pass() #
TEST.equal(VAL, VAL2) #Object.is()
#Aliases: TEST.equals|isEqual|is|strictEqual[s]()
TEST.notEqual(VAL, VAL2) #!Object.is()
#Aliases: TEST.notEquals|isNotEqual|doesNotEqual|isInequal|isNot|not|notStrictEqual[s]()
TEST.looseEqual(VAL, VAL2) #==
#Aliases: TEST.looseEquals()
TEST.notLooseEqual(VAL, VAL2) #!=
#Aliases: TEST.notLooseEquals()
TEST.deepEqual(VAL, VAL2) #Deep ===
#Aliases: TEST.deepEquals|isEquivalent|same()
TEST.notDeepEqual(VAL, VAL2) #Deep !==
#Aliases: TEST.notDeepEquals|[is]notEquivalent|[is]notDeeply|notSame|isNotDeepEqual|isInequivalent()
TEST.deepLooseEqual(VAL, VAL2) #Deep ==
#Aliases: TEST.looseEqual[s]()
TEST.notDeepLooseEqual(VAL, VAL2) #Deep !=
#Aliases: TEST.notLooseEqual[s]()
TEST.error(ERROR) #== false (i.e. undefined)
#Aliases: TEST.ifErr[or]()
┌─────────────┐
│ BOOLEAN │
└─────────────┘
TEST.ok(VAL) #== true
#Aliases: TEST.true|assert()
TEST.notOk(VAL) #== false
#Aliases: TEST.false()
┌────────────┐
│ STRING │
└────────────┘
TEST.match|doesNotMatch
(STR, REGEXP) #REGEXP.test(STR)
┌──────────────┐
│ FUNCTION │
└──────────────┘
TEST.throws(FUNC[, REGEXP|TYPE]) #FUNC() throws
#ERROR.message matches REGEXP or ERROR instanceof TYPE
TEST.doesNotThrow
(FUNC[, REGEXP|TYPE]) #Inverse
┌────────────┐
│ CUSTOM │
└────────────┘
TEST.assertion(FUNC(...), ...) #Calls FUNC.call(TEST, ...)