From 5dd43081bb65a369d06e10b25648b5e6f9ac25b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Sat, 7 Mar 2020 20:54:17 +0100 Subject: [PATCH] use robuster feature checks in tests --- package.json | 2 ++ tests/index.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f04c627..4e64672 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ }, "devDependencies": { "airtap": "^1.0.0", + "functions-have-names": "^1.2.1", + "has-symbols": "^1.0.1", "isarray": "^2.0.2", "tape": "^4.8.0" }, diff --git a/tests/index.js b/tests/index.js index 1f06256..0ea452a 100644 --- a/tests/index.js +++ b/tests/index.js @@ -1,4 +1,6 @@ var test = require('tape'); +var functionsHaveNames = require('functions-have-names'); +var hasSymbols = require('has-symbols'); require('./legacy-compat'); var common = require('./common'); @@ -25,7 +27,7 @@ require('./listener-count.js'); require('./listeners-side-effects.js'); require('./listeners.js'); require('./max-listeners.js'); -if ((function A () {}).name === 'A') { +if (functionsHaveNames()) { require('./method-names.js'); } else { // Function.name is not supported in IE @@ -38,7 +40,7 @@ require('./prepend.js'); require('./set-max-listeners-side-effects.js'); require('./special-event-names.js'); require('./subclass.js'); -if (typeof Symbol === 'function') { +if (hasSymbols()) { require('./symbols.js'); } else { // Symbol is not available.