summaryrefslogtreecommitdiff
path: root/mocha_test/asyncFunctions.js
diff options
context:
space:
mode:
authorAlexander Early <alexander.early@gmail.com>2017-03-22 13:20:15 -0700
committerAlexander Early <alexander.early@gmail.com>2017-03-22 13:20:15 -0700
commit9fc2995f581e500dbe9a54939feeaf11b0655b28 (patch)
tree13a24321bd6f8c753665e4a850c6e33c393f06ac /mocha_test/asyncFunctions.js
parent295b307c21028c8069ced8fe01a3d68700e15e0b (diff)
downloadasync-9fc2995f581e500dbe9a54939feeaf11b0655b28.tar.gz
initial experiment with async fn support
Diffstat (limited to 'mocha_test/asyncFunctions.js')
-rw-r--r--mocha_test/asyncFunctions.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/mocha_test/asyncFunctions.js b/mocha_test/asyncFunctions.js
new file mode 100644
index 0000000..67e1b16
--- /dev/null
+++ b/mocha_test/asyncFunctions.js
@@ -0,0 +1,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');
+ }
+});