@@ -331,7 +331,7 @@ target.test = function() {
331
331
matchCopy ( path . join ( '**' , '@(*.ps1|*.psm1)' ) , path . join ( __dirname , 'Tests' , 'lib' ) , path . join ( buildTestsPath , 'lib' ) ) ;
332
332
333
333
var suiteType = options . suite || 'L0' ;
334
- function runTaskTests ( taskName , failWithNoTests ) {
334
+ function runTaskTests ( taskName ) {
335
335
banner ( 'Testing: ' + taskName ) ;
336
336
// find the tests
337
337
var nodeVersion = options . node || getTaskNodeVersion ( buildPath , taskName ) + "" ;
@@ -347,28 +347,25 @@ target.test = function() {
347
347
testsSpec . push ( pattern2 ) ;
348
348
}
349
349
350
- if ( ! testsSpec . length && ! process . env . TF_BUILD ) {
351
- if ( failWithNoTests ) {
352
- fail ( `Unable to find tests using the following patterns: ${ JSON . stringify ( [ pattern1 , pattern2 ] ) } ` ) ;
353
- } else {
354
- console . warn ( `Unable to find tests using the following patterns: ${ JSON . stringify ( [ pattern1 , pattern2 ] ) } ` ) ;
355
- }
350
+ if ( testsSpec . length == 0 ) {
351
+ console . warn ( `Unable to find tests using the following patterns: ${ JSON . stringify ( [ pattern1 , pattern2 ] ) } ` ) ;
356
352
return ;
357
353
}
354
+
358
355
// setup the version of node to run the tests
359
356
util . installNode ( nodeVersion ) ;
360
357
361
358
run ( 'mocha ' + testsSpec . join ( ' ' ) /*+ ' --reporter mocha-junit-reporter --reporter-options mochaFile=../testresults/test-results.xml'*/ , /*inheritStreams:*/ true ) ;
362
359
}
363
360
364
361
if ( options . task ) {
365
- runTaskTests ( options . task , true ) ;
362
+ runTaskTests ( options . task ) ;
366
363
} else {
367
364
// Run tests for each task that exists
368
365
taskList . forEach ( function ( taskName ) {
369
366
var taskPath = path . join ( buildPath , taskName ) ;
370
367
if ( fs . existsSync ( taskPath ) ) {
371
- runTaskTests ( taskName , false ) ;
368
+ runTaskTests ( taskName ) ;
372
369
}
373
370
} ) ;
374
371
@@ -378,7 +375,7 @@ target.test = function() {
378
375
if ( matchFind ( commonLibPattern , buildPath ) . length > 0 ) {
379
376
specs . push ( commonLibPattern ) ;
380
377
}
381
- if ( specs . length ) {
378
+ if ( specs . length > 0 ) {
382
379
// setup the version of node to run the tests
383
380
util . installNode ( options . node ) ;
384
381
run ( 'mocha ' + specs . join ( ' ' ) /*+ ' --reporter mocha-junit-reporter --reporter-options mochaFile=../testresults/test-results.xml'*/ , /*inheritStreams:*/ true ) ;
@@ -391,7 +388,7 @@ target.test = function() {
391
388
banner ( 'Running common tests' ) ;
392
389
var commonPattern = path . join ( buildTestsPath , suiteType + '.js' ) ;
393
390
var specs = matchFind ( commonPattern , buildTestsPath , { noRecurse : true } ) ;
394
- if ( specs . length ) {
391
+ if ( specs . length > 0 ) {
395
392
// setup the version of node to run the tests
396
393
util . installNode ( options . node ) ;
397
394
run ( 'mocha ' + specs . join ( ' ' ) /*+ ' --reporter mocha-junit-reporter --reporter-options mochaFile=../testresults/test-results.xml'*/ , /*inheritStreams:*/ true ) ;
0 commit comments