index.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. Object.defineProperty(exports, 'bind', {
  6. enumerable: true,
  7. get: function get() {
  8. return _bind.default;
  9. }
  10. });
  11. exports.default = void 0;
  12. function _types() {
  13. const data = require('@jest/types');
  14. _types = function _types() {
  15. return data;
  16. };
  17. return data;
  18. }
  19. var _bind = _interopRequireDefault(require('./bind'));
  20. function _interopRequireDefault(obj) {
  21. return obj && obj.__esModule ? obj : {default: obj};
  22. }
  23. /**
  24. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  25. *
  26. * This source code is licensed under the MIT license found in the
  27. * LICENSE file in the root directory of this source tree.
  28. *
  29. */
  30. const install = (g, table, ...data) => {
  31. const test = (title, test, timeout) =>
  32. (0, _bind.default)(g.test)(table, ...data)(title, test, timeout);
  33. test.skip = (0, _bind.default)(g.test.skip)(table, ...data);
  34. test.only = (0, _bind.default)(g.test.only)(table, ...data);
  35. const it = (title, test, timeout) =>
  36. (0, _bind.default)(g.it)(table, ...data)(title, test, timeout);
  37. it.skip = (0, _bind.default)(g.it.skip)(table, ...data);
  38. it.only = (0, _bind.default)(g.it.only)(table, ...data);
  39. const xit = (0, _bind.default)(g.xit)(table, ...data);
  40. const fit = (0, _bind.default)(g.fit)(table, ...data);
  41. const xtest = (0, _bind.default)(g.xtest)(table, ...data);
  42. const describe = (title, suite, timeout) =>
  43. (0, _bind.default)(g.describe, false)(table, ...data)(
  44. title,
  45. suite,
  46. timeout
  47. );
  48. describe.skip = (0, _bind.default)(g.describe.skip, false)(table, ...data);
  49. describe.only = (0, _bind.default)(g.describe.only, false)(table, ...data);
  50. const fdescribe = (0, _bind.default)(g.fdescribe, false)(table, ...data);
  51. const xdescribe = (0, _bind.default)(g.xdescribe, false)(table, ...data);
  52. return {
  53. describe,
  54. fdescribe,
  55. fit,
  56. it,
  57. test,
  58. xdescribe,
  59. xit,
  60. xtest
  61. };
  62. };
  63. const each = (table, ...data) => install(global, table, ...data);
  64. each.withGlobal = g => (table, ...data) => install(g, table, ...data);
  65. var _default = each;
  66. exports.default = _default;