File tree 3 files changed +46
-1
lines changed
3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ Test.prototype._exit = function () {
214
214
exiting : true
215
215
} ) ;
216
216
} else if ( ! this . ended ) {
217
- this . fail ( 'test exited without ending' , {
217
+ this . fail ( 'test exited without ending: ' + this . name , {
218
218
exiting : true
219
219
} ) ;
220
220
}
Original file line number Diff line number Diff line change @@ -204,3 +204,36 @@ tap.test('todo failing', function (t) {
204
204
t . equal ( code , 0 ) ;
205
205
} ) ;
206
206
} ) ;
207
+
208
+ tap . test ( 'forgot to call t.end()' , function ( t ) {
209
+ t . plan ( 2 ) ;
210
+
211
+ var tc = function ( rows ) {
212
+ t . same ( stripFullStack ( rows . toString ( 'utf8' ) ) , [
213
+ 'TAP version 13' ,
214
+ '# first' ,
215
+ 'ok 1 should be truthy' ,
216
+ '# oops forgot end' ,
217
+ 'ok 2 should be truthy' ,
218
+ 'not ok 3 test exited without ending: oops forgot end' ,
219
+ ' ---' ,
220
+ ' operator: fail' ,
221
+ ' at: process.<anonymous> ($TAPE/index.js:$LINE:$COL)' ,
222
+ ' stack: |-' ,
223
+ ' Error: test exited without ending: oops forgot end' ,
224
+ ' [... stack stripped ...]' ,
225
+ ' ...' ,
226
+ '' ,
227
+ '1..3' ,
228
+ '# tests 3' ,
229
+ '# pass 2' ,
230
+ '# fail 1'
231
+ ] . join ( '\n' ) + '\n\n' ) ;
232
+ } ;
233
+
234
+ var ps = spawn ( process . execPath , [ path . join ( __dirname , '/exit/missing_end.js' ) ] ) ;
235
+ ps . stdout . pipe ( concat ( tc ) ) ;
236
+ ps . on ( 'exit' , function ( code ) {
237
+ t . notEqual ( code , 0 ) ;
238
+ } ) ;
239
+ } ) ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ var test = require ( '../../' ) ;
4
+
5
+ test ( 'first' , function ( t ) {
6
+ t . ok ( true ) ;
7
+ t . end ( ) ;
8
+ } ) ;
9
+
10
+ test ( 'oops forgot end' , function ( t ) {
11
+ t . ok ( true ) ;
12
+ } ) ;
You can’t perform that action at this time.
0 commit comments