hypotes 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -769,7 +769,7 @@ Rules for mocks:
769
769
  | Rule | What it checks |
770
770
  | ------------------------------ | ----------------------------------------------------------------------------------------- |
771
771
  | `hoisted-apis-on-top` | `vi.mock()`, `vi.unmock()` and `vi.hoisted()` are top-level statements, where they hoist. |
772
- | `require-mock-type-parameters` | `vi.fn()` is given the type of the function that it mocks, in TypeScript. |
772
+ | `require-mock-type-parameters` | `vi.fn()` without an implementation is given the type that it mocks, in TypeScript. |
773
773
 
774
774
  ## License
775
775
 
@@ -812,13 +812,14 @@ const plugin = {
812
812
  "require-mock-type-parameters": {
813
813
  meta: {
814
814
  type: "problem",
815
- docs: { description: "Requires vi.fn() to be given the type of the function that it mocks, in TypeScript" }
815
+ docs: { description: "Requires a vi.fn() without an implementation to be given the type of the function that it mocks, in TypeScript" }
816
816
  },
817
817
  create(context) {
818
818
  if (!TYPESCRIPT.test(context.filename)) return {};
819
819
  return { CallExpression(call) {
820
820
  const method = viMethodOf(context, call);
821
821
  if (method?.property.name !== "fn" || call.typeArguments) return;
822
+ if (call.arguments.length > 0) return;
822
823
  context.report({
823
824
  node: method.property,
824
825
  message: "Expected vi.fn() to be given the type of the function that it mocks, as in vi.fn<() => void>()"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypotes",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Vitest's API on node:test. Same tests, no Vite.",
5
5
  "keywords": [
6
6
  "expect",