@@ -286,11 +286,13 @@ const _tests = [];
286
286
287
287
return addManifest ( manifest , _tests )
288
288
. then ( ( ) => {
289
- _testsToMocha ( _tests ) ;
290
- } ) . then ( ( ) => {
289
+ return _testsToMocha ( _tests ) ;
290
+ } ) . then ( result => {
291
291
if ( options . earl . report ) {
292
292
describe ( 'Writing EARL report to: ' + options . earl . filename , function ( ) {
293
- it ( 'should print the earl report' , function ( ) {
293
+ // print out EARL even if .only was used
294
+ const _it = result . hadOnly ? it . only : it ;
295
+ _it ( 'should print the earl report' , function ( ) {
294
296
return options . writeFile (
295
297
options . earl . filename , options . earl . report . reportJson ( ) ) ;
296
298
} ) ;
@@ -300,6 +302,7 @@ return addManifest(manifest, _tests)
300
302
301
303
// build mocha tests from local test structure
302
304
function _testsToMocha ( tests ) {
305
+ let hadOnly = false ;
303
306
tests . forEach ( suite => {
304
307
if ( suite . skip ) {
305
308
describe . skip ( suite . title ) ;
@@ -308,17 +311,22 @@ function _testsToMocha(tests) {
308
311
describe ( suite . title , ( ) => {
309
312
suite . tests . forEach ( test => {
310
313
if ( test . only ) {
314
+ hadOnly = true ;
311
315
it . only ( test . title , test . f ) ;
312
316
return ;
313
317
}
314
318
it ( test . title , test . f ) ;
315
319
} ) ;
316
- _testsToMocha ( suite . suites ) ;
320
+ const { hadOnly : _hadOnly } = _testsToMocha ( suite . suites ) ;
321
+ hadOnly = hadOnly || _hadOnly ;
317
322
} ) ;
318
323
suite . imports . forEach ( f => {
319
324
options . import ( f ) ;
320
325
} ) ;
321
326
} ) ;
327
+ return {
328
+ hadOnly
329
+ } ;
322
330
}
323
331
324
332
} ) ;
0 commit comments