index.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. var test = require('tape');
  2. var functionsHaveNames = require('functions-have-names');
  3. var hasSymbols = require('has-symbols');
  4. require('./legacy-compat');
  5. var common = require('./common');
  6. // we do this to easily wrap each file in a mocha test
  7. // and also have browserify be able to statically analyze this file
  8. var orig_require = require;
  9. var require = function(file) {
  10. test(file, function(t) {
  11. // Store the tape object so tests can access it.
  12. t.on('end', function () { delete common.test; });
  13. common.test = t;
  14. try {
  15. var exp = orig_require(file);
  16. if (exp && exp.then) {
  17. exp.then(function () { t.end(); }, t.fail);
  18. return;
  19. }
  20. } catch (err) {
  21. t.fail(err);
  22. }
  23. t.end();
  24. });
  25. };
  26. require('./add-listeners.js');
  27. require('./check-listener-leaks.js');
  28. require('./errors.js');
  29. require('./events-list.js');
  30. if (typeof Promise === 'function') {
  31. require('./events-once.js');
  32. } else {
  33. // Promise support is not available.
  34. test('./events-once.js', { skip: true }, function () {});
  35. }
  36. require('./listener-count.js');
  37. require('./listeners-side-effects.js');
  38. require('./listeners.js');
  39. require('./max-listeners.js');
  40. if (functionsHaveNames()) {
  41. require('./method-names.js');
  42. } else {
  43. // Function.name is not supported in IE
  44. test('./method-names.js', { skip: true }, function () {});
  45. }
  46. require('./modify-in-emit.js');
  47. require('./num-args.js');
  48. require('./once.js');
  49. require('./prepend.js');
  50. require('./set-max-listeners-side-effects.js');
  51. require('./special-event-names.js');
  52. require('./subclass.js');
  53. if (hasSymbols()) {
  54. require('./symbols.js');
  55. } else {
  56. // Symbol is not available.
  57. test('./symbols.js', { skip: true }, function () {});
  58. }
  59. require('./remove-all-listeners.js');
  60. require('./remove-listeners.js');