@@ -26,6 +26,8 @@ var thrower = function () { throw messageGetterError; };
26
26
tap . test ( 'failures' , function ( tt ) {
27
27
tt . plan ( 1 ) ;
28
28
29
+ var maybeCause = 'cause' in Error . prototype ? '[cause]: undefined, ' : '' ;
30
+
29
31
var test = tape . createHarness ( ) ;
30
32
test . createStream ( ) . pipe ( concat ( function ( body ) {
31
33
tt . same ( stripFullStack ( body . toString ( 'utf8' ) ) , [
@@ -37,7 +39,7 @@ tap.test('failures', function (tt) {
37
39
' expected: |-' ,
38
40
' undefined' ,
39
41
' actual: |-' ,
40
- ' { [TypeError: ' + getNonFunctionMessage ( ) + "] message: '" + getNonFunctionMessage ( ) + "' }" ,
42
+ ' { [TypeError: ' + getNonFunctionMessage ( ) + '] ' + maybeCause + " message: '" + getNonFunctionMessage ( ) + "' }" ,
41
43
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
42
44
' stack: |-' ,
43
45
String ( ' TypeError: ' + getNonFunctionMessage ( undefined ) ) ,
@@ -51,7 +53,7 @@ tap.test('failures', function (tt) {
51
53
' expected: |-' ,
52
54
' undefined' ,
53
55
' actual: |-' ,
54
- ' { [TypeError: ' + getNonFunctionMessage ( null ) + "] message: '" + getNonFunctionMessage ( null ) + "' }" ,
56
+ ' { [TypeError: ' + getNonFunctionMessage ( null ) + '] ' + maybeCause + " message: '" + getNonFunctionMessage ( null ) + "' }" ,
55
57
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
56
58
' stack: |-' ,
57
59
String ( ' TypeError: ' + getNonFunctionMessage ( null ) ) ,
@@ -65,7 +67,7 @@ tap.test('failures', function (tt) {
65
67
' expected: |-' ,
66
68
' undefined' ,
67
69
' actual: |-' ,
68
- ' { [TypeError: ' + getNonFunctionMessage ( true ) + "] message: '" + getNonFunctionMessage ( true ) + "' }" ,
70
+ ' { [TypeError: ' + getNonFunctionMessage ( true ) + '] ' + maybeCause + " message: '" + getNonFunctionMessage ( true ) + "' }" ,
69
71
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
70
72
' stack: |-' ,
71
73
String ( ' TypeError: ' + getNonFunctionMessage ( true ) ) ,
@@ -79,7 +81,7 @@ tap.test('failures', function (tt) {
79
81
' expected: |-' ,
80
82
' undefined' ,
81
83
' actual: |-' ,
82
- ' { [TypeError: ' + getNonFunctionMessage ( false ) + "] message: '" + getNonFunctionMessage ( false ) + "' }" ,
84
+ ' { [TypeError: ' + getNonFunctionMessage ( false ) + '] ' + maybeCause + " message: '" + getNonFunctionMessage ( false ) + "' }" ,
83
85
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
84
86
' stack: |-' ,
85
87
String ( ' TypeError: ' + getNonFunctionMessage ( false ) ) ,
@@ -93,7 +95,7 @@ tap.test('failures', function (tt) {
93
95
' expected: |-' ,
94
96
' undefined' ,
95
97
' actual: |-' ,
96
- ' { [TypeError: ' + getNonFunctionMessage ( 'abc' ) + "] message: '" + getNonFunctionMessage ( 'abc' ) + "' }" ,
98
+ ' { [TypeError: ' + getNonFunctionMessage ( 'abc' ) + '] ' + maybeCause + " message: '" + getNonFunctionMessage ( 'abc' ) + "' }" ,
97
99
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
98
100
' stack: |-' ,
99
101
String ( ' TypeError: ' + getNonFunctionMessage ( 'abc' ) ) ,
@@ -107,7 +109,7 @@ tap.test('failures', function (tt) {
107
109
' expected: |-' ,
108
110
' undefined' ,
109
111
' actual: |-' ,
110
- ' { [TypeError: ' + getNonFunctionMessage ( / a / g) + "] message: '" + getNonFunctionMessage ( / a / g) + "' }" ,
112
+ ' { [TypeError: ' + getNonFunctionMessage ( / a / g) + '] ' + maybeCause + " message: '" + getNonFunctionMessage ( / a / g) + "' }" ,
111
113
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
112
114
' stack: |-' ,
113
115
String ( ' TypeError: ' + getNonFunctionMessage ( / a / g) ) ,
@@ -121,7 +123,7 @@ tap.test('failures', function (tt) {
121
123
' expected: |-' ,
122
124
' undefined' ,
123
125
' actual: |-' ,
124
- ' { [TypeError: ' + getNonFunctionMessage ( [ ] ) + "] message: '" + getNonFunctionMessage ( [ ] ) + "' }" ,
126
+ ' { [TypeError: ' + getNonFunctionMessage ( [ ] ) + '] ' + maybeCause + " message: '" + getNonFunctionMessage ( [ ] ) + "' }" ,
125
127
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
126
128
' stack: |-' ,
127
129
String ( ' TypeError: ' + getNonFunctionMessage ( [ ] ) ) ,
@@ -135,7 +137,7 @@ tap.test('failures', function (tt) {
135
137
' expected: |-' ,
136
138
' undefined' ,
137
139
' actual: |-' ,
138
- ' { [TypeError: ' + getNonFunctionMessage ( { } ) + "] message: '" + getNonFunctionMessage ( { } ) + "' }" ,
140
+ ' { [TypeError: ' + getNonFunctionMessage ( { } ) + '] ' + maybeCause + " message: '" + getNonFunctionMessage ( { } ) + "' }" ,
139
141
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
140
142
' stack: |-' ,
141
143
String ( ' TypeError: ' + getNonFunctionMessage ( { } ) ) ,
@@ -169,7 +171,7 @@ tap.test('failures', function (tt) {
169
171
' expected: |-' ,
170
172
' [Function: TypeError]' ,
171
173
' actual: |-' ,
172
- ' { [RangeError: actual!] ' + ( 'cause' in Error . prototype ? '[cause]: undefined, ' : '' ) + "message: 'actual!' }" ,
174
+ ' { [RangeError: actual!] ' + maybeCause + "message: 'actual!' }" ,
173
175
' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
174
176
' stack: |-' ,
175
177
' RangeError: actual!' ,
0 commit comments