Commit 19907c2
test: use mustCall() for simple flow tracking
Many of the tests use variables to track when callback functions
are invoked or events are emitted. These variables are then
asserted on process exit. This commit replaces this pattern in
straightforward cases with common.mustCall(). This makes the
tests easier to reason about, leads to a net reduction in lines
of code, and uncovered a few bugs in tests. This commit also
replaces some callbacks that should never be called with
common.fail().
PR-URL: #7753
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>1 parent 79d4986 commit 19907c2Copy full SHA for 19907c2
File tree
Expand file treeCollapse file tree
212 files changed
+1095
-2859
lines changedOpen diff view settings
Filter options
- test
- addons/async-hello-world
- internet
- parallel
- pummel
- sequential
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Expand file treeCollapse file tree
212 files changed
+1095
-2859
lines changedOpen diff view settings
Collapse file
test/addons/async-hello-world/test.js
Copy file name to clipboard+4-11Lines changed: 4 additions & 11 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | | - |
| 2 | + |
3 | 3 | |
4 | 4 | |
5 | | - |
6 | 5 | |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
| 6 | + |
12 | 7 | |
13 | 8 | |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
| 9 | + |
| 10 | + |
Collapse file
test/internet/test-http-dns-fail.js
Copy file name to clipboardExpand all lines: test/internet/test-http-dns-fail.js+2-6Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4 | 4 | |
5 | 5 | |
6 | 6 | |
7 | | - |
| 7 | + |
8 | 8 | |
9 | 9 | |
10 | 10 | |
11 | | - |
12 | 11 | |
13 | 12 | |
14 | 13 | |
| ||
19 | 18 | |
20 | 19 | |
21 | 20 | |
22 | | - |
23 | | - |
24 | | - |
| 21 | + |
25 | 22 | |
26 | 23 | |
27 | 24 | |
| ||
37 | 34 | |
38 | 35 | |
39 | 36 | |
40 | | - |
41 | 37 | |
42 | 38 | |
Collapse file
test/internet/test-http-https-default-ports.js
Copy file name to clipboard+4-15Lines changed: 4 additions & 15 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | 2 | |
3 | | - |
4 | 3 | |
5 | 4 | |
6 | 5 | |
| ||
9 | 8 | |
10 | 9 | |
11 | 10 | |
12 | | - |
13 | | - |
14 | 11 | |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
| 12 | + |
23 | 13 | |
24 | | - |
| 14 | + |
25 | 15 | |
26 | | - |
27 | | - |
| 16 | + |
28 | 17 | |
29 | | - |
| 18 | + |
Collapse file
test/internet/test-net-connect-timeout.js
Copy file name to clipboardExpand all lines: test/internet/test-net-connect-timeout.js+4-19Lines changed: 4 additions & 19 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3 | 3 | |
4 | 4 | |
5 | 5 | |
6 | | - |
| 6 | + |
7 | 7 | |
8 | 8 | |
9 | 9 | |
10 | 10 | |
11 | 11 | |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | 12 | |
17 | 13 | |
18 | 14 | |
| ||
23 | 19 | |
24 | 20 | |
25 | 21 | |
26 | | - |
| 22 | + |
27 | 23 | |
28 | | - |
29 | 24 | |
30 | 25 | |
31 | 26 | |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
| 27 | + |
40 | 28 | |
41 | | - |
42 | | - |
43 | | - |
44 | | - |
| 29 | + |
Collapse file
test/internet/test-net-connect-unref.js
Copy file name to clipboard+4-15Lines changed: 4 additions & 15 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | | - |
3 | | - |
| 2 | + |
4 | 3 | |
5 | 4 | |
6 | | - |
| 5 | + |
7 | 6 | |
8 | 7 | |
9 | 8 | |
10 | 9 | |
11 | 10 | |
12 | 11 | |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
| 12 | + |
21 | 13 | |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
| 14 | + |
Collapse file
test/parallel/test-child-process-buffering.js
Copy file name to clipboardExpand all lines: test/parallel/test-child-process-buffering.js+4-17Lines changed: 4 additions & 17 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | 5 | |
10 | 6 | |
11 | 7 | |
| ||
16 | 12 | |
17 | 13 | |
18 | 14 | |
19 | | - |
| 15 | + |
20 | 16 | |
21 | 17 | |
22 | | - |
23 | | - |
| 18 | + |
24 | 19 | |
25 | | - |
| 20 | + |
26 | 21 | |
27 | | - |
28 | | - |
29 | | - |
| 22 | + |
30 | 23 | |
31 | 24 | |
32 | 25 | |
| ||
35 | 28 | |
36 | 29 | |
37 | 30 | |
38 | | - |
39 | | - |
40 | | - |
41 | | - |
42 | | - |
43 | | - |
Collapse file
test/parallel/test-child-process-disconnect.js
Copy file name to clipboardExpand all lines: test/parallel/test-child-process-disconnect.js+3-11Lines changed: 3 additions & 11 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | | - |
52 | | - |
53 | 51 | |
54 | 52 | |
55 | 53 | |
56 | 54 | |
57 | | - |
58 | | - |
| 55 | + |
59 | 56 | |
60 | | - |
| 57 | + |
61 | 58 | |
62 | 59 | |
63 | | - |
64 | | - |
65 | | - |
| 60 | + |
66 | 61 | |
67 | 62 | |
68 | 63 | |
| ||
91 | 86 | |
92 | 87 | |
93 | 88 | |
94 | | - |
95 | | - |
96 | | - |
97 | 89 | |
98 | 90 | |
Collapse file
test/parallel/test-child-process-exec-buffer.js
Copy file name to clipboard+5-16Lines changed: 5 additions & 16 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | | - |
| 2 | + |
3 | 3 | |
4 | 4 | |
5 | 5 | |
6 | | - |
7 | | - |
8 | | - |
9 | 6 | |
10 | 7 | |
11 | 8 | |
12 | | - |
| 9 | + |
13 | 10 | |
14 | 11 | |
15 | 12 | |
16 | | - |
17 | | - |
18 | | - |
| 13 | + |
19 | 14 | |
20 | 15 | |
21 | 16 | |
22 | 17 | |
23 | | - |
| 18 | + |
24 | 19 | |
25 | 20 | |
26 | 21 | |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
| 22 | + |
Collapse file
test/parallel/test-child-process-exec-cwd.js
Copy file name to clipboardExpand all lines: test/parallel/test-child-process-exec-cwd.js+4-21Lines changed: 4 additions & 21 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3 | 3 | |
4 | 4 | |
5 | 5 | |
6 | | - |
7 | | - |
8 | | - |
9 | 6 | |
10 | 7 | |
11 | 8 | |
| ||
16 | 13 | |
17 | 14 | |
18 | 15 | |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
Collapse file
test/parallel/test-child-process-exec-error.js
Copy file name to clipboardExpand all lines: test/parallel/test-child-process-exec-error.js+2-9Lines changed: 2 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4 | 4 | |
5 | 5 | |
6 | 6 | |
7 | | - |
8 | | - |
9 | | - |
| 7 | + |
10 | 8 | |
11 | 9 | |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
| 10 | + |
18 | 11 | |
19 | 12 | |
20 | 13 | |
|
0 commit comments