File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,16 @@ not ok 1 global failure
67
67
# skip 0
68
68
# todo 0
69
69
# fail 1
70
+ ` ,
71
+
72
+ "qunit 'fail/mocked-console.js'" :
73
+ `TAP version 13
74
+ ok 2 Uncaught error > good
75
+ 1..2
76
+ # pass 1
77
+ # skip 0
78
+ # todo 0
79
+ # fail 1
70
80
` ,
71
81
72
82
"qunit test single.js 'glob/**/*-test.js'" :
Original file line number Diff line number Diff line change
1
+ QUnit . module ( "Error with mocked console" , function ( hooks ) {
2
+ var orgLog , orgError ;
3
+
4
+ // Stub
5
+ hooks . before ( function ( ) {
6
+ orgLog = console . log ;
7
+ orgError = console . error ;
8
+ console . log = console . error = function ( ) { } ;
9
+ } ) ;
10
+
11
+ // Restore
12
+ hooks . after ( function ( ) {
13
+ console . error = orgError ;
14
+ console . log = orgLog ;
15
+ } ) ;
16
+
17
+ QUnit . test ( "bad" , function ( assert ) {
18
+ assert . ok ( this . aint ( ) ) ;
19
+ } ) ;
20
+
21
+ QUnit . test ( "good" , function ( assert ) {
22
+ assert . ok ( 1 ) ;
23
+ } ) ;
24
+ } ) ;
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ QUnit.module( "CLI Main", function() {
79
79
}
80
80
} ) ) ;
81
81
82
+ // Test case for https://github.com/qunitjs/qunit/issues/1333
82
83
QUnit . test ( "report assert.throws() failures properly" , co . wrap ( function * ( assert ) {
83
84
const command = "qunit fail/throws-match.js" ;
84
85
try {
@@ -91,6 +92,19 @@ QUnit.module( "CLI Main", function() {
91
92
}
92
93
} ) ) ;
93
94
95
+ // Test case for https://github.com/qunitjs/qunit/issues/1340
96
+ QUnit . test ( "report errors with mocked console" , co . wrap ( function * ( assert ) {
97
+ const command = "qunit fail/mocked-console.js" ;
98
+ try {
99
+ yield execute ( command ) ;
100
+ } catch ( e ) {
101
+ assert . equal ( e . code , 1 ) ;
102
+ assert . equal ( e . stderr , "" ) ;
103
+ const re = new RegExp ( expectedOutput [ command ] ) ;
104
+ assert . equal ( re . test ( e . stdout ) , true ) ;
105
+ }
106
+ } ) ) ;
107
+
94
108
QUnit . test ( "exit code is 1 when failing tests are present" , co . wrap ( function * ( assert ) {
95
109
try {
96
110
yield execute ( "qunit fail/failure.js" ) ;
You can’t perform that action at this time.
0 commit comments