index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.bind = undefined;
  6. var _bind;
  7. function _load_bind() {
  8. return (_bind = _interopRequireDefault(require('./bind')));
  9. }
  10. function _interopRequireDefault(obj) {
  11. return obj && obj.__esModule ? obj : {default: obj};
  12. }
  13. const install = function(g) {
  14. for (
  15. var _len = arguments.length,
  16. args = Array(_len > 1 ? _len - 1 : 0),
  17. _key = 1;
  18. _key < _len;
  19. _key++
  20. ) {
  21. args[_key - 1] = arguments[_key];
  22. }
  23. const test = (title, test, timeout) =>
  24. (0, (_bind || _load_bind()).default)(g.test).apply(undefined, args)(
  25. title,
  26. test,
  27. timeout
  28. );
  29. test.skip = (0, (_bind || _load_bind()).default)(g.test.skip).apply(
  30. undefined,
  31. args
  32. );
  33. test.only = (0, (_bind || _load_bind()).default)(g.test.only).apply(
  34. undefined,
  35. args
  36. );
  37. const it = (title, test, timeout) =>
  38. (0, (_bind || _load_bind()).default)(g.it).apply(undefined, args)(
  39. title,
  40. test,
  41. timeout
  42. );
  43. it.skip = (0, (_bind || _load_bind()).default)(g.it.skip).apply(
  44. undefined,
  45. args
  46. );
  47. it.only = (0, (_bind || _load_bind()).default)(g.it.only).apply(
  48. undefined,
  49. args
  50. );
  51. const xit = (0, (_bind || _load_bind()).default)(g.xit).apply(
  52. undefined,
  53. args
  54. );
  55. const fit = (0, (_bind || _load_bind()).default)(g.fit).apply(
  56. undefined,
  57. args
  58. );
  59. const xtest = (0, (_bind || _load_bind()).default)(g.xtest).apply(
  60. undefined,
  61. args
  62. );
  63. const describe = (title, suite, timeout) =>
  64. (0, (_bind || _load_bind()).default)(g.describe, false).apply(
  65. undefined,
  66. args
  67. )(title, suite, timeout);
  68. describe.skip = (0, (_bind || _load_bind()).default)(
  69. g.describe.skip,
  70. false
  71. ).apply(undefined, args);
  72. describe.only = (0, (_bind || _load_bind()).default)(
  73. g.describe.only,
  74. false
  75. ).apply(undefined, args);
  76. const fdescribe = (0, (_bind || _load_bind()).default)(
  77. g.fdescribe,
  78. false
  79. ).apply(undefined, args);
  80. const xdescribe = (0, (_bind || _load_bind()).default)(
  81. g.xdescribe,
  82. false
  83. ).apply(undefined, args);
  84. return {
  85. describe: describe,
  86. fdescribe: fdescribe,
  87. fit: fit,
  88. it: it,
  89. test: test,
  90. xdescribe: xdescribe,
  91. xit: xit,
  92. xtest: xtest
  93. };
  94. };
  95. /**
  96. * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  97. *
  98. * This source code is licensed under the MIT license found in the
  99. * LICENSE file in the root directory of this source tree.
  100. *
  101. *
  102. */
  103. const each = function() {
  104. for (
  105. var _len2 = arguments.length, args = Array(_len2), _key2 = 0;
  106. _key2 < _len2;
  107. _key2++
  108. ) {
  109. args[_key2] = arguments[_key2];
  110. }
  111. return install.apply(undefined, [global].concat(args));
  112. };
  113. each.withGlobal = g =>
  114. function() {
  115. for (
  116. var _len3 = arguments.length, args = Array(_len3), _key3 = 0;
  117. _key3 < _len3;
  118. _key3++
  119. ) {
  120. args[_key3] = arguments[_key3];
  121. }
  122. return install.apply(undefined, [g].concat(args));
  123. };
  124. exports.bind = (_bind || _load_bind()).default;
  125. exports.default = each;