Commit 9f3acb7 1 parent 2f47bfd commit 9f3acb7 Copy full SHA for 9f3acb7
File tree 2 files changed +20
-12
lines changed
2 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -47,16 +47,16 @@ output:
47
47
48
48
```
49
49
repeat-it
50
- ✓ 1 repeated test
51
- ✓ 2 repeated test
52
- ✓ 3 repeated test
53
- ✓ 4 repeated test
54
- ✓ 5 repeated test
55
- ✓ 6 repeated test
56
- ✓ 7 repeated test
57
- ✓ 8 repeated test
58
- ✓ 9 repeated test
59
- ✓ 10 repeated test
50
+ ✓ 1/10 repeated test
51
+ ✓ 2/10 repeated test
52
+ ✓ 3/10 repeated test
53
+ ✓ 4/10 repeated test
54
+ ✓ 5/10 repeated test
55
+ ✓ 6/10 repeated test
56
+ ✓ 7/10 repeated test
57
+ ✓ 8/10 repeated test
58
+ ✓ 9/10 repeated test
59
+ ✓ 10/10 repeated test
60
60
61
61
10 passing (10ms)
62
62
```
Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ function checkTimes (times) {
21
21
console . assert ( isNonNegative ( times ) , 'repeat times should be non-negative' )
22
22
}
23
23
24
+ function formatMessage ( title , times ) {
25
+ return function finishFormat ( k ) {
26
+ return k + 1 + '/' + times + ' ' + title
27
+ }
28
+ }
29
+
24
30
function only ( times ) {
25
31
if ( ! isNumber ( times ) ) {
26
32
// probably plain it('name', ...) call
@@ -31,8 +37,9 @@ function only (times) {
31
37
32
38
return function ( title , fn ) {
33
39
let k
40
+ const fullTitle = formatMessage ( title , times )
34
41
for ( k = 0 ; k < times ; k += 1 ) {
35
- oldIt . only ( k + 1 + ' ' + title , fn )
42
+ oldIt . only ( fullTitle ( k ) , fn )
36
43
}
37
44
}
38
45
}
@@ -47,8 +54,9 @@ function repeatIt (times) {
47
54
48
55
return function ( title , fn ) {
49
56
let k
57
+ const fullTitle = formatMessage ( title , times )
50
58
for ( k = 0 ; k < times ; k += 1 ) {
51
- oldIt ( k + 1 + ' ' + title , fn )
59
+ oldIt ( fullTitle ( k ) , fn )
52
60
}
53
61
}
54
62
}
You can’t perform that action at this time.
0 commit comments