summaryrefslogtreecommitdiff
path: root/mocha_test/asyncFunctions.js
blob: 67e1b161e94fde78388edfe4ca4f618cd0999383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
describe('async function support', function () {
    this.timeout(100);

    var supportsAsync;
    var supportsSymbol = typeof Symbol !== 'undefined';
    try {
        /* eslint no-eval:0 */
        var fn = eval('(async function() {})')
        supportsAsync = supportsSymbol &&
            fn[Symbol.toStringTag] === 'AsyncFunction';
    } catch (e) {
        supportsAsync = false;
    }

    if (supportsAsync) {
        require('./es2017/asyncFunctions.js')();
    } else {
        it('should not test async functions in this environment');
    }
});