File tree 1 file changed +35
-0
lines changed
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,41 @@ test('Bug reproduction. should not fail if argument is null Literal. ' + JSON.st
64
64
} ) ;
65
65
66
66
67
+ test ( 'assertion with optional message argument. ' + JSON . stringify ( option ) , function ( ) {
68
+ var falsy = 0 ;
69
+ try {
70
+ eval ( weave ( 'assert(falsy, "assertion message");' ) ) ;
71
+ assert . ok ( false , 'AssertionError should be thrown' ) ;
72
+ } catch ( e ) {
73
+ baseAssert . equal ( e . name , 'AssertionError' ) ;
74
+ if ( option . modifyMessageOnFail ) {
75
+ baseAssert . equal ( e . message , [
76
+ 'assertion message /path/to/some_test.js' ,
77
+ 'assert(falsy, "assertion message")' ,
78
+ '[{"value":0,"espath":"arguments/0"}]'
79
+ ] . join ( '\n' ) ) ;
80
+ }
81
+ if ( option . saveContextOnFail ) {
82
+ baseAssert . deepEqual ( e . powerAssertContext , {
83
+ "source" :{
84
+ "content" : "assert(falsy, \"assertion message\")" ,
85
+ "filepath" : "/path/to/some_test.js" ,
86
+ "line" : 1
87
+ } ,
88
+ "args" :[
89
+ {
90
+ "value" : 0 ,
91
+ "events" : [
92
+ { "value" :0 , "espath" :"arguments/0" }
93
+ ]
94
+ }
95
+ ]
96
+ } ) ;
97
+ }
98
+ }
99
+ } ) ;
100
+
101
+
67
102
test ( JSON . stringify ( option ) + ' empowered function also acts like an assert function' , function ( ) {
68
103
var falsy = 0 ;
69
104
try {
You can’t perform that action at this time.
0 commit comments