@@ -425,12 +425,6 @@ runTests = (CoffeeScript) ->
425
425
catch err
426
426
onFail description, fn, err
427
427
428
- global .supportsAsync = try
429
- new Function (' async () => {}' )()
430
- yes
431
- catch
432
- no
433
-
434
428
helpers .extend global , require ' ./test/support/helpers'
435
429
436
430
# When all the tests have run, collect and print errors.
@@ -448,10 +442,18 @@ runTests = (CoffeeScript) ->
448
442
console .log " #{ source} " if source
449
443
return
450
444
451
- # Run every test in the `test` folder, recording failures.
452
- files = fs .readdirSync ' test'
453
- unless global .supportsAsync # Except for async tests, if async isn’t supported.
454
- files = files .filter (filename) -> filename isnt ' async.coffee'
445
+ # Run every test in the `test` folder, recording failures, except for files
446
+ # we’re skipping because the features to be tested are unsupported in the
447
+ # current Node runtime.
448
+ testFilesToSkip = []
449
+ skipUnless = (featureDetect , filenames ) ->
450
+ unless (try new Function featureDetect)
451
+ testFilesToSkip = testFilesToSkip .concat filenames
452
+ skipUnless ' async () => {}' , [' async.coffee' , ' async_iterators.coffee' ]
453
+ skipUnless ' async function* generator() { yield 42; }' , [' async_iterators.coffee' ]
454
+ skipUnless ' var a = 2 ** 2; a **= 3' , [' exponentiation.coffee' ]
455
+ files = fs .readdirSync (' test' ).filter (filename) ->
456
+ filename not in testFilesToSkip
455
457
456
458
startTime = Date .now ()
457
459
for file in files when helpers .isCoffee file
0 commit comments