版博士V2.0程序
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

chunk-integrations-utils.23c19408.js 3.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import { suite, test, describe, it, beforeAll, beforeEach, afterAll, afterEach, onTestFailed } from '@vitest/runner';
  2. import { b as bench, c as createExpect, g as globalExpect, v as vitest, a as vi } from './chunk-utils-import.e488ace3.js';
  3. import { r as runOnce, i as isFirstRun } from './chunk-integrations-run-once.ea614f17.js';
  4. import * as chai from 'chai';
  5. import { assert, should } from 'chai';
  6. function getRunningMode() {
  7. return process.env.VITEST_MODE === "WATCH" ? "watch" : "run";
  8. }
  9. function isWatchMode() {
  10. return getRunningMode() === "watch";
  11. }
  12. var dist = {};
  13. (function (exports) {
  14. Object.defineProperty(exports, "__esModule", { value: true });
  15. exports.expectTypeOf = void 0;
  16. const fn = () => true;
  17. /**
  18. * Similar to Jest's `expect`, but with type-awareness.
  19. * Gives you access to a number of type-matchers that let you make assertions about the
  20. * form of a reference or generic type parameter.
  21. *
  22. * @example
  23. * import {foo, bar} from '../foo'
  24. * import {expectTypeOf} from 'expect-type'
  25. *
  26. * test('foo types', () => {
  27. * // make sure `foo` has type {a: number}
  28. * expectTypeOf(foo).toMatchTypeOf({a: 1})
  29. * expectTypeOf(foo).toHaveProperty('a').toBeNumber()
  30. *
  31. * // make sure `bar` is a function taking a string:
  32. * expectTypeOf(bar).parameter(0).toBeString()
  33. * expectTypeOf(bar).returns.not.toBeAny()
  34. * })
  35. *
  36. * @description
  37. * See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
  38. */
  39. const expectTypeOf = (_actual) => {
  40. const nonFunctionProperties = [
  41. 'parameters',
  42. 'returns',
  43. 'resolves',
  44. 'not',
  45. 'items',
  46. 'constructorParameters',
  47. 'instance',
  48. 'guards',
  49. 'asserts',
  50. ];
  51. const obj = {
  52. /* eslint-disable mmkal/@typescript-eslint/no-unsafe-assignment */
  53. toBeAny: fn,
  54. toBeUnknown: fn,
  55. toBeNever: fn,
  56. toBeFunction: fn,
  57. toBeObject: fn,
  58. toBeArray: fn,
  59. toBeString: fn,
  60. toBeNumber: fn,
  61. toBeBoolean: fn,
  62. toBeVoid: fn,
  63. toBeSymbol: fn,
  64. toBeNull: fn,
  65. toBeUndefined: fn,
  66. toBeNullable: fn,
  67. toMatchTypeOf: fn,
  68. toEqualTypeOf: fn,
  69. toBeCallableWith: fn,
  70. toBeConstructibleWith: fn,
  71. /* eslint-enable mmkal/@typescript-eslint/no-unsafe-assignment */
  72. extract: exports.expectTypeOf,
  73. exclude: exports.expectTypeOf,
  74. toHaveProperty: exports.expectTypeOf,
  75. parameter: exports.expectTypeOf,
  76. };
  77. const getterProperties = nonFunctionProperties;
  78. getterProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) }));
  79. return obj;
  80. };
  81. exports.expectTypeOf = expectTypeOf;
  82. } (dist));
  83. const noop = () => {
  84. };
  85. const assertType = noop;
  86. var index = /*#__PURE__*/Object.freeze({
  87. __proto__: null,
  88. suite: suite,
  89. test: test,
  90. describe: describe,
  91. it: it,
  92. beforeAll: beforeAll,
  93. beforeEach: beforeEach,
  94. afterAll: afterAll,
  95. afterEach: afterEach,
  96. onTestFailed: onTestFailed,
  97. bench: bench,
  98. runOnce: runOnce,
  99. isFirstRun: isFirstRun,
  100. assert: assert,
  101. should: should,
  102. createExpect: createExpect,
  103. chai: chai,
  104. expect: globalExpect,
  105. vitest: vitest,
  106. vi: vi,
  107. getRunningMode: getRunningMode,
  108. isWatchMode: isWatchMode,
  109. expectTypeOf: dist.expectTypeOf,
  110. assertType: assertType
  111. });
  112. export { isWatchMode as a, assertType as b, dist as d, getRunningMode as g, index as i };