uilint-eslint 0.2.151 → 0.2.153

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.
Files changed (34) hide show
  1. package/package.json +2 -2
  2. package/src/rules/__fixtures__/coverage/with-aggregate-coverage/coverage/coverage-final.json +0 -76
  3. package/src/rules/__fixtures__/coverage/with-aggregate-coverage/src/Component.test.tsx +0 -8
  4. package/src/rules/__fixtures__/coverage/with-aggregate-coverage/src/Component.tsx +0 -8
  5. package/src/rules/__fixtures__/coverage/with-aggregate-coverage/src/NonJsxFile.tsx +0 -5
  6. package/src/rules/__fixtures__/coverage/with-aggregate-coverage/src/WellTestedComponent.test.tsx +0 -8
  7. package/src/rules/__fixtures__/coverage/with-aggregate-coverage/src/WellTestedComponent.tsx +0 -4
  8. package/src/rules/__fixtures__/coverage/with-aggregate-coverage/src/useHook.ts +0 -14
  9. package/src/rules/__fixtures__/coverage/with-aggregate-coverage/src/utils.ts +0 -8
  10. package/src/rules/__fixtures__/coverage/with-chunk-coverage/coverage/coverage-final.json +0 -52
  11. package/src/rules/__fixtures__/coverage/with-chunk-coverage/src/Button.tsx +0 -13
  12. package/src/rules/__fixtures__/coverage/with-chunk-coverage/src/useCounter.ts +0 -14
  13. package/src/rules/__fixtures__/coverage/with-chunk-coverage/src/utils.test.ts +0 -11
  14. package/src/rules/__fixtures__/coverage/with-chunk-coverage/src/utils.ts +0 -19
  15. package/src/rules/__fixtures__/coverage/with-full-coverage/coverage/coverage-final.json +0 -19
  16. package/src/rules/__fixtures__/coverage/with-full-coverage/src/utils.test.ts +0 -15
  17. package/src/rules/__fixtures__/coverage/with-full-coverage/src/utils.ts +0 -15
  18. package/src/rules/__fixtures__/coverage/with-git-changes/coverage/coverage-final.json +0 -22
  19. package/src/rules/__fixtures__/coverage/with-git-changes/src/modified.ts +0 -21
  20. package/src/rules/__fixtures__/coverage/with-jsx-coverage/coverage/coverage-final.json +0 -70
  21. package/src/rules/__fixtures__/coverage/with-jsx-coverage/src/ComponentWithHandlers.test.tsx +0 -10
  22. package/src/rules/__fixtures__/coverage/with-jsx-coverage/src/ComponentWithHandlers.tsx +0 -34
  23. package/src/rules/__fixtures__/coverage/with-jsx-coverage/src/WellTestedComponent.test.tsx +0 -10
  24. package/src/rules/__fixtures__/coverage/with-jsx-coverage/src/WellTestedComponent.tsx +0 -16
  25. package/src/rules/__fixtures__/coverage/with-no-coverage-data/src/utils.ts +0 -7
  26. package/src/rules/__fixtures__/coverage/with-no-tests/coverage/coverage-final.json +0 -15
  27. package/src/rules/__fixtures__/coverage/with-no-tests/src/hasTest.test.ts +0 -7
  28. package/src/rules/__fixtures__/coverage/with-no-tests/src/hasTest.ts +0 -7
  29. package/src/rules/__fixtures__/coverage/with-no-tests/src/noTest.ts +0 -11
  30. package/src/rules/__fixtures__/coverage/with-partial-coverage/coverage/coverage-final.json +0 -51
  31. package/src/rules/__fixtures__/coverage/with-partial-coverage/src/covered.test.ts +0 -12
  32. package/src/rules/__fixtures__/coverage/with-partial-coverage/src/covered.ts +0 -11
  33. package/src/rules/__fixtures__/coverage/with-partial-coverage/src/uncovered.test.ts +0 -8
  34. package/src/rules/__fixtures__/coverage/with-partial-coverage/src/uncovered.ts +0 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uilint-eslint",
3
- "version": "0.2.151",
3
+ "version": "0.2.153",
4
4
  "description": "ESLint plugin for UILint - AI-powered UI consistency checking",
5
5
  "author": "Peter Suggate",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "@typescript-eslint/utils": "^8.35.1",
36
36
  "oxc-resolver": "^11.0.0",
37
37
  "xxhash-wasm": "^1.1.0",
38
- "uilint-core": "0.2.151"
38
+ "uilint-core": "0.2.153"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/eslint": "^9.6.1",
@@ -1,76 +0,0 @@
1
- {
2
- "/src/Component.tsx": {
3
- "path": "/src/Component.tsx",
4
- "statementMap": {
5
- "0": { "start": { "line": 5, "column": 2 }, "end": { "line": 5, "column": 25 } },
6
- "1": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 40 } }
7
- },
8
- "fnMap": {
9
- "0": { "name": "Component", "decl": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 25 } }, "loc": { "start": { "line": 4, "column": 28 }, "end": { "line": 7, "column": 1 } } }
10
- },
11
- "branchMap": {},
12
- "s": { "0": 5, "1": 5 },
13
- "f": { "0": 5 },
14
- "b": {}
15
- },
16
- "/src/useHook.ts": {
17
- "path": "/src/useHook.ts",
18
- "statementMap": {
19
- "0": { "start": { "line": 2, "column": 2 }, "end": { "line": 2, "column": 30 } },
20
- "1": { "start": { "line": 3, "column": 2 }, "end": { "line": 3, "column": 35 } },
21
- "2": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 20 } },
22
- "3": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 25 } },
23
- "4": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 20 } }
24
- },
25
- "fnMap": {
26
- "0": { "name": "useData", "decl": { "start": { "line": 1, "column": 16 }, "end": { "line": 1, "column": 23 } }, "loc": { "start": { "line": 1, "column": 26 }, "end": { "line": 5, "column": 1 } } },
27
- "1": { "name": "fetchFromApi", "decl": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 21 } }, "loc": { "start": { "line": 7, "column": 24 }, "end": { "line": 9, "column": 1 } } },
28
- "2": { "name": "processData", "decl": { "start": { "line": 11, "column": 9 }, "end": { "line": 11, "column": 20 } }, "loc": { "start": { "line": 11, "column": 49 }, "end": { "line": 13, "column": 1 } } }
29
- },
30
- "branchMap": {},
31
- "s": { "0": 0, "1": 0, "2": 0, "3": 0, "4": 0 },
32
- "f": { "0": 0, "1": 0, "2": 0 },
33
- "b": {}
34
- },
35
- "/src/utils.ts": {
36
- "path": "/src/utils.ts",
37
- "statementMap": {
38
- "0": { "start": { "line": 2, "column": 2 }, "end": { "line": 2, "column": 22 } },
39
- "1": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 28 } }
40
- },
41
- "fnMap": {
42
- "0": { "name": "formatValue", "decl": { "start": { "line": 1, "column": 16 }, "end": { "line": 1, "column": 27 } }, "loc": { "start": { "line": 1, "column": 48 }, "end": { "line": 3, "column": 1 } } },
43
- "1": { "name": "parseValue", "decl": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 26 } }, "loc": { "start": { "line": 5, "column": 46 }, "end": { "line": 7, "column": 1 } } }
44
- },
45
- "branchMap": {},
46
- "s": { "0": 5, "1": 0 },
47
- "f": { "0": 5, "1": 0 },
48
- "b": {}
49
- },
50
- "/src/WellTestedComponent.tsx": {
51
- "path": "/src/WellTestedComponent.tsx",
52
- "statementMap": {
53
- "0": { "start": { "line": 2, "column": 2 }, "end": { "line": 2, "column": 35 } }
54
- },
55
- "fnMap": {
56
- "0": { "name": "WellTestedComponent", "decl": { "start": { "line": 1, "column": 16 }, "end": { "line": 1, "column": 35 } }, "loc": { "start": { "line": 1, "column": 38 }, "end": { "line": 3, "column": 1 } } }
57
- },
58
- "branchMap": {},
59
- "s": { "0": 10 },
60
- "f": { "0": 10 },
61
- "b": {}
62
- },
63
- "/src/NonJsxFile.tsx": {
64
- "path": "/src/NonJsxFile.tsx",
65
- "statementMap": {
66
- "0": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 20 } }
67
- },
68
- "fnMap": {
69
- "0": { "name": "helper", "decl": { "start": { "line": 3, "column": 16 }, "end": { "line": 3, "column": 22 } }, "loc": { "start": { "line": 3, "column": 44 }, "end": { "line": 5, "column": 1 } } }
70
- },
71
- "branchMap": {},
72
- "s": { "0": 5 },
73
- "f": { "0": 5 },
74
- "b": {}
75
- }
76
- }
@@ -1,8 +0,0 @@
1
- // Test file for Component
2
- import { Component } from "./Component";
3
-
4
- describe("Component", () => {
5
- it("renders", () => {
6
- // Test coverage for component
7
- });
8
- });
@@ -1,8 +0,0 @@
1
- // Component that imports hook and utils - used for aggregate coverage testing
2
- import { useData } from "./useHook";
3
- import { formatValue } from "./utils";
4
-
5
- export function Component() {
6
- const data = useData();
7
- return <div>{formatValue(data)}</div>;
8
- }
@@ -1,5 +0,0 @@
1
- // A .tsx file that doesn't actually contain JSX
2
- // Should not trigger aggregate coverage check
3
- export function helper(value: number): number {
4
- return value * 2;
5
- }
@@ -1,8 +0,0 @@
1
- // Test file for WellTestedComponent
2
- import { WellTestedComponent } from "./WellTestedComponent";
3
-
4
- describe("WellTestedComponent", () => {
5
- it("renders", () => {
6
- // Test coverage for component
7
- });
8
- });
@@ -1,4 +0,0 @@
1
- // Well-tested component with no dependencies - high aggregate coverage
2
- export function WellTestedComponent() {
3
- return <div>Hello World</div>;
4
- }
@@ -1,14 +0,0 @@
1
- // Hook with low coverage (0%) - used for aggregate coverage testing
2
- export function useData() {
3
- const data = fetchFromApi();
4
- const processed = processData(data);
5
- return processed;
6
- }
7
-
8
- function fetchFromApi() {
9
- return { value: 42 };
10
- }
11
-
12
- function processData(data: { value: number }) {
13
- return data.value;
14
- }
@@ -1,8 +0,0 @@
1
- // Utility file with medium coverage (50%) - used for aggregate coverage testing
2
- export function formatValue(value: number): string {
3
- return String(value);
4
- }
5
-
6
- export function parseValue(str: string): number {
7
- return parseInt(str, 10);
8
- }
@@ -1,52 +0,0 @@
1
- {
2
- "/src/utils.ts": {
3
- "path": "/src/utils.ts",
4
- "statementMap": {
5
- "0": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 30 } },
6
- "1": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 28 } },
7
- "2": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 49 } },
8
- "3": { "start": { "line": 18, "column": 2 }, "end": { "line": 18, "column": 30 } }
9
- },
10
- "fnMap": {
11
- "0": { "name": "formatName", "decl": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 26 } }, "loc": { "start": { "line": 5, "column": 60 }, "end": { "line": 7, "column": 1 } } },
12
- "1": { "name": "validateEmail", "decl": { "start": { "line": 9, "column": 16 }, "end": { "line": 9, "column": 29 } }, "loc": { "start": { "line": 9, "column": 47 }, "end": { "line": 11, "column": 1 } } },
13
- "2": { "name": "calculateTotal", "decl": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 30 } }, "loc": { "start": { "line": 13, "column": 54 }, "end": { "line": 15, "column": 1 } } },
14
- "3": { "name": "formatCurrency", "decl": { "start": { "line": 17, "column": 13 }, "end": { "line": 17, "column": 27 } }, "loc": { "start": { "line": 17, "column": 49 }, "end": { "line": 19, "column": 1 } } }
15
- },
16
- "branchMap": {},
17
- "s": { "0": 10, "1": 5, "2": 0, "3": 0 },
18
- "f": { "0": 10, "1": 5, "2": 0, "3": 0 },
19
- "b": {}
20
- },
21
- "/src/Button.tsx": {
22
- "path": "/src/Button.tsx",
23
- "statementMap": {
24
- "0": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 51 } },
25
- "1": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 27 } }
26
- },
27
- "fnMap": {
28
- "0": { "name": "Button", "decl": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 22 } }, "loc": { "start": { "line": 7, "column": 75 }, "end": { "line": 9, "column": 1 } } },
29
- "1": { "name": "handleClick", "decl": { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 27 } }, "loc": { "start": { "line": 11, "column": 30 }, "end": { "line": 13, "column": 1 } } }
30
- },
31
- "branchMap": {},
32
- "s": { "0": 3, "1": 0 },
33
- "f": { "0": 3, "1": 0 },
34
- "b": {}
35
- },
36
- "/src/useCounter.ts": {
37
- "path": "/src/useCounter.ts",
38
- "statementMap": {
39
- "0": { "start": { "line": 8, "column": 2 }, "end": { "line": 8, "column": 40 } },
40
- "1": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 43 } },
41
- "2": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 43 } },
42
- "3": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 44 } }
43
- },
44
- "fnMap": {
45
- "0": { "name": "useCounter", "decl": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 26 } }, "loc": { "start": { "line": 7, "column": 45 }, "end": { "line": 14, "column": 1 } } }
46
- },
47
- "branchMap": {},
48
- "s": { "0": 5, "1": 5, "2": 3, "3": 5 },
49
- "f": { "0": 5 },
50
- "b": {}
51
- }
52
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Component file for testing chunk-level coverage with focusNonReact
3
- */
4
-
5
- import React from "react";
6
-
7
- export function Button({ onClick, label }: { onClick: () => void; label: string }) {
8
- return <button onClick={onClick}>{label}</button>;
9
- }
10
-
11
- export function handleClick() {
12
- console.log("clicked");
13
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * Hook file for testing chunk-level coverage
3
- */
4
-
5
- import { useState } from "react";
6
-
7
- export function useCounter(initial: number = 0) {
8
- const [count, setCount] = useState(initial);
9
-
10
- const increment = () => setCount(c => c + 1);
11
- const decrement = () => setCount(c => c - 1);
12
-
13
- return { count, increment, decrement };
14
- }
@@ -1,11 +0,0 @@
1
- // Placeholder test file
2
- import { formatName, validateEmail } from "./utils";
3
-
4
- describe("utils", () => {
5
- it("formatName works", () => {
6
- expect(formatName("John", "Doe")).toBe("John Doe");
7
- });
8
- it("validateEmail works", () => {
9
- expect(validateEmail("test@example.com")).toBe(true);
10
- });
11
- });
@@ -1,19 +0,0 @@
1
- /**
2
- * Utility functions with mixed coverage for testing chunk-level reporting
3
- */
4
-
5
- export function formatName(first: string, last: string): string {
6
- return `${first} ${last}`;
7
- }
8
-
9
- export function validateEmail(email: string): boolean {
10
- return email.includes("@");
11
- }
12
-
13
- export function calculateTotal(items: number[]): number {
14
- return items.reduce((sum, item) => sum + item, 0);
15
- }
16
-
17
- export const formatCurrency = (amount: number): string => {
18
- return `$${amount.toFixed(2)}`;
19
- };
@@ -1,19 +0,0 @@
1
- {
2
- "/src/utils.ts": {
3
- "path": "/src/utils.ts",
4
- "statementMap": {
5
- "0": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 16 } },
6
- "1": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 16 } },
7
- "2": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 16 } }
8
- },
9
- "fnMap": {
10
- "0": { "name": "add", "decl": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 19 } }, "loc": { "start": { "line": 5, "column": 47 }, "end": { "line": 7, "column": 1 } } },
11
- "1": { "name": "subtract", "decl": { "start": { "line": 9, "column": 16 }, "end": { "line": 9, "column": 24 } }, "loc": { "start": { "line": 9, "column": 52 }, "end": { "line": 11, "column": 1 } } },
12
- "2": { "name": "multiply", "decl": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 24 } }, "loc": { "start": { "line": 13, "column": 52 }, "end": { "line": 15, "column": 1 } } }
13
- },
14
- "branchMap": {},
15
- "s": { "0": 5, "1": 3, "2": 2 },
16
- "f": { "0": 5, "1": 3, "2": 2 },
17
- "b": {}
18
- }
19
- }
@@ -1,15 +0,0 @@
1
- import { add, subtract, multiply } from "./utils";
2
-
3
- describe("utils", () => {
4
- it("adds numbers", () => {
5
- expect(add(1, 2)).toBe(3);
6
- });
7
-
8
- it("subtracts numbers", () => {
9
- expect(subtract(5, 3)).toBe(2);
10
- });
11
-
12
- it("multiplies numbers", () => {
13
- expect(multiply(2, 3)).toBe(6);
14
- });
15
- });
@@ -1,15 +0,0 @@
1
- /**
2
- * Utility functions with full test coverage
3
- */
4
-
5
- export function add(a: number, b: number): number {
6
- return a + b;
7
- }
8
-
9
- export function subtract(a: number, b: number): number {
10
- return a - b;
11
- }
12
-
13
- export function multiply(a: number, b: number): number {
14
- return a * b;
15
- }
@@ -1,22 +0,0 @@
1
- {
2
- "/src/modified.ts": {
3
- "path": "/src/modified.ts",
4
- "statementMap": {
5
- "0": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 20 } },
6
- "1": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 20 } },
7
- "2": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 17 } },
8
- "3": { "start": { "line": 19, "column": 2 }, "end": { "line": 19, "column": 11 } }
9
- },
10
- "fnMap": {
11
- "0": { "name": "existingFunction", "decl": { "start": { "line": 6, "column": 16 }, "end": { "line": 6, "column": 32 } }, "loc": { "start": { "line": 6, "column": 44 }, "end": { "line": 8, "column": 1 } } },
12
- "1": { "name": "newFunction", "decl": { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 27 } }, "loc": { "start": { "line": 11, "column": 39 }, "end": { "line": 13, "column": 1 } } },
13
- "2": { "name": "anotherNewFunction", "decl": { "start": { "line": 16, "column": 16 }, "end": { "line": 16, "column": 34 } }, "loc": { "start": { "line": 16, "column": 53 }, "end": { "line": 20, "column": 1 } } }
14
- },
15
- "branchMap": {
16
- "0": { "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 19, "column": 11 } }, "type": "if", "locations": [{ "start": { "line": 17, "column": 2 }, "end": { "line": 17, "column": 17 } }, { "start": { "line": 19, "column": 2 }, "end": { "line": 19, "column": 11 } }] }
17
- },
18
- "s": { "0": 5, "1": 0, "2": 0, "3": 0 },
19
- "f": { "0": 5, "1": 0, "2": 0 },
20
- "b": { "0": [0, 0] }
21
- }
22
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * File with git changes - some lines are new and uncovered
3
- */
4
-
5
- // This function existed before and is covered
6
- export function existingFunction(): string {
7
- return "I exist";
8
- }
9
-
10
- // This function was added recently and is NOT covered
11
- export function newFunction(): string {
12
- return "I am new";
13
- }
14
-
15
- // Another new function, also not covered
16
- export function anotherNewFunction(x: number): number {
17
- if (x > 0) {
18
- return x * 2;
19
- }
20
- return 0;
21
- }
@@ -1,70 +0,0 @@
1
- {
2
- "/src/ComponentWithHandlers.tsx": {
3
- "path": "/src/ComponentWithHandlers.tsx",
4
- "statementMap": {
5
- "0": { "start": { "line": 2, "column": 0 }, "end": { "line": 5, "column": 3 } },
6
- "1": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 24 } },
7
- "2": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 31 } },
8
- "3": { "start": { "line": 7, "column": 0 }, "end": { "line": 10, "column": 3 } },
9
- "4": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 28 } },
10
- "5": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 17 } },
11
- "6": { "start": { "line": 12, "column": 0 }, "end": { "line": 14, "column": 3 } },
12
- "7": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 19 } },
13
- "8": { "start": { "line": 16, "column": 2 }, "end": { "line": 23, "column": 4 } },
14
- "9": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 59 } },
15
- "10": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 54 } }
16
- },
17
- "s": {
18
- "0": 1,
19
- "1": 0,
20
- "2": 0,
21
- "3": 1,
22
- "4": 0,
23
- "5": 0,
24
- "6": 1,
25
- "7": 0,
26
- "8": 1,
27
- "9": 0,
28
- "10": 0
29
- },
30
- "fnMap": {
31
- "0": { "name": "ComponentWithHandlers", "decl": { "start": { "line": 1, "column": 16 }, "end": { "line": 1, "column": 38 } }, "loc": { "start": { "line": 1, "column": 41 }, "end": { "line": 24, "column": 1 } } },
32
- "1": { "name": "handleSubmit", "decl": { "start": { "line": 2, "column": 8 }, "end": { "line": 2, "column": 20 } }, "loc": { "start": { "line": 2, "column": 47 }, "end": { "line": 5, "column": 3 } } },
33
- "2": { "name": "handleClick", "decl": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 19 } }, "loc": { "start": { "line": 7, "column": 25 }, "end": { "line": 10, "column": 3 } } },
34
- "3": { "name": "doSomething", "decl": { "start": { "line": 12, "column": 11 }, "end": { "line": 12, "column": 22 } }, "loc": { "start": { "line": 12, "column": 25 }, "end": { "line": 14, "column": 3 } } }
35
- },
36
- "f": {
37
- "0": 1,
38
- "1": 0,
39
- "2": 0,
40
- "3": 0
41
- },
42
- "branchMap": {},
43
- "b": {}
44
- },
45
- "/src/WellTestedComponent.tsx": {
46
- "path": "/src/WellTestedComponent.tsx",
47
- "statementMap": {
48
- "0": { "start": { "line": 2, "column": 0 }, "end": { "line": 5, "column": 3 } },
49
- "1": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 28 } },
50
- "2": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 24 } },
51
- "3": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 51 } }
52
- },
53
- "s": {
54
- "0": 5,
55
- "1": 5,
56
- "2": 5,
57
- "3": 5
58
- },
59
- "fnMap": {
60
- "0": { "name": "WellTestedComponent", "decl": { "start": { "line": 1, "column": 16 }, "end": { "line": 1, "column": 35 } }, "loc": { "start": { "line": 1, "column": 38 }, "end": { "line": 10, "column": 1 } } },
61
- "1": { "name": "handleClick", "decl": { "start": { "line": 2, "column": 8 }, "end": { "line": 2, "column": 19 } }, "loc": { "start": { "line": 2, "column": 25 }, "end": { "line": 5, "column": 3 } } }
62
- },
63
- "f": {
64
- "0": 5,
65
- "1": 5
66
- },
67
- "branchMap": {},
68
- "b": {}
69
- }
70
- }
@@ -1,10 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
-
3
- describe("ComponentWithHandlers", () => {
4
- it("placeholder test for fixture", () => {
5
- // This is a fixture file used for testing the require-test-coverage rule
6
- // The actual component is not tested here - this file exists to satisfy
7
- // the test file existence check
8
- expect(true).toBe(true);
9
- });
10
- });
@@ -1,34 +0,0 @@
1
- /**
2
- * Fixture: Component with event handlers for JSX element coverage testing
3
- *
4
- * This component has:
5
- * - Button with onClick handler (lines 12-18)
6
- * - Input with onChange handler (line 22)
7
- * - Form with onSubmit handler (lines 8-10)
8
- * - Div without handlers (should be ignored)
9
- */
10
-
11
- export function ComponentWithHandlers() {
12
- const handleSubmit = (e: React.FormEvent) => {
13
- e.preventDefault();
14
- console.log("submitted");
15
- };
16
-
17
- const handleClick = () => {
18
- console.log("clicked");
19
- doSomething();
20
- };
21
-
22
- function doSomething() {
23
- return "done";
24
- }
25
-
26
- return (
27
- <form onSubmit={handleSubmit}>
28
- <div>
29
- <input onChange={(e) => console.log(e.target.value)} />
30
- <button onClick={handleClick}>Submit</button>
31
- </div>
32
- </form>
33
- );
34
- }
@@ -1,10 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
-
3
- describe("WellTestedComponent", () => {
4
- it("placeholder test for fixture", () => {
5
- // This is a fixture file used for testing the require-test-coverage rule
6
- // The actual component is not tested here - this file exists to satisfy
7
- // the test file existence check
8
- expect(true).toBe(true);
9
- });
10
- });
@@ -1,16 +0,0 @@
1
- /**
2
- * Fixture: Well-tested component for JSX element coverage testing
3
- *
4
- * This component has its onClick handler fully tested.
5
- */
6
-
7
- export function WellTestedComponent() {
8
- const handleClick = () => {
9
- console.log("clicked");
10
- return "handled";
11
- };
12
-
13
- return (
14
- <button onClick={handleClick}>Click me</button>
15
- );
16
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * File in a project with no coverage data collected
3
- */
4
-
5
- export function process(data: string): string {
6
- return data.trim().toLowerCase();
7
- }
@@ -1,15 +0,0 @@
1
- {
2
- "/src/hasTest.ts": {
3
- "path": "/src/hasTest.ts",
4
- "statementMap": {
5
- "0": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 28 } }
6
- },
7
- "fnMap": {
8
- "0": { "name": "greet", "decl": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 21 } }, "loc": { "start": { "line": 5, "column": 42 }, "end": { "line": 7, "column": 1 } } }
9
- },
10
- "branchMap": {},
11
- "s": { "0": 3 },
12
- "f": { "0": 3 },
13
- "b": {}
14
- }
15
- }
@@ -1,7 +0,0 @@
1
- import { greet } from "./hasTest";
2
-
3
- describe("hasTest", () => {
4
- it("greets", () => {
5
- expect(greet("World")).toBe("Hello, World!");
6
- });
7
- });
@@ -1,7 +0,0 @@
1
- /**
2
- * File that has a corresponding test file
3
- */
4
-
5
- export function greet(name: string): string {
6
- return `Hello, ${name}!`;
7
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * File that has NO corresponding test file
3
- */
4
-
5
- export function farewell(name: string): string {
6
- return `Goodbye, ${name}!`;
7
- }
8
-
9
- export function wave(): string {
10
- return "👋";
11
- }
@@ -1,51 +0,0 @@
1
- {
2
- "/src/covered.ts": {
3
- "path": "/src/covered.ts",
4
- "statementMap": {
5
- "0": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 30 } },
6
- "1": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 28 } },
7
- "2": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 28 } },
8
- "3": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 28 } },
9
- "4": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 28 } },
10
- "5": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 28 } },
11
- "6": { "start": { "line": 15, "column": 2 }, "end": { "line": 15, "column": 28 } },
12
- "7": { "start": { "line": 16, "column": 2 }, "end": { "line": 16, "column": 28 } },
13
- "8": { "start": { "line": 17, "column": 2 }, "end": { "line": 17, "column": 28 } },
14
- "9": { "start": { "line": 18, "column": 2 }, "end": { "line": 18, "column": 28 } }
15
- },
16
- "fnMap": {
17
- "0": { "name": "formatName", "decl": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 26 } }, "loc": { "start": { "line": 5, "column": 60 }, "end": { "line": 7, "column": 1 } } },
18
- "1": { "name": "formatDate", "decl": { "start": { "line": 9, "column": 16 }, "end": { "line": 9, "column": 26 } }, "loc": { "start": { "line": 9, "column": 45 }, "end": { "line": 11, "column": 1 } } }
19
- },
20
- "branchMap": {},
21
- "s": { "0": 5, "1": 3, "2": 2, "3": 2, "4": 2, "5": 2, "6": 2, "7": 2, "8": 2, "9": 0 },
22
- "f": { "0": 5, "1": 3 },
23
- "b": {}
24
- },
25
- "/src/uncovered.ts": {
26
- "path": "/src/uncovered.ts",
27
- "statementMap": {
28
- "0": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 50 } },
29
- "1": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 13 } },
30
- "2": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 48 } },
31
- "3": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 13 } },
32
- "4": { "start": { "line": 19, "column": 2 }, "end": { "line": 19, "column": 28 } },
33
- "5": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 13 } },
34
- "6": { "start": { "line": 26, "column": 2 }, "end": { "line": 26, "column": 28 } }
35
- },
36
- "fnMap": {
37
- "0": { "name": "calculateTotal", "decl": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 30 } }, "loc": { "start": { "line": 5, "column": 55 }, "end": { "line": 7, "column": 1 } } },
38
- "1": { "name": "calculateAverage", "decl": { "start": { "line": 9, "column": 16 }, "end": { "line": 9, "column": 32 } }, "loc": { "start": { "line": 9, "column": 57 }, "end": { "line": 13, "column": 1 } } },
39
- "2": { "name": "calculateMax", "decl": { "start": { "line": 15, "column": 16 }, "end": { "line": 15, "column": 28 } }, "loc": { "start": { "line": 15, "column": 53 }, "end": { "line": 20, "column": 1 } } },
40
- "3": { "name": "calculateMin", "decl": { "start": { "line": 22, "column": 16 }, "end": { "line": 22, "column": 28 } }, "loc": { "start": { "line": 22, "column": 53 }, "end": { "line": 27, "column": 1 } } }
41
- },
42
- "branchMap": {
43
- "0": { "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 13 } }, "type": "if", "locations": [{ "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 13 } }, { "start": { "line": 10, "column": 2 }, "end": { "line": 10, "column": 13 } }] },
44
- "1": { "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 17, "column": 13 } }, "type": "if", "locations": [{ "start": { "line": 17, "column": 2 }, "end": { "line": 17, "column": 13 } }, { "start": { "line": 17, "column": 2 }, "end": { "line": 17, "column": 13 } }] },
45
- "2": { "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 24, "column": 13 } }, "type": "if", "locations": [{ "start": { "line": 24, "column": 2 }, "end": { "line": 24, "column": 13 } }, { "start": { "line": 24, "column": 2 }, "end": { "line": 24, "column": 13 } }] }
46
- },
47
- "s": { "0": 2, "1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "6": 0 },
48
- "f": { "0": 2, "1": 0, "2": 0, "3": 0 },
49
- "b": { "0": [0, 0], "1": [0, 0], "2": [0, 0] }
50
- }
51
- }
@@ -1,12 +0,0 @@
1
- import { formatName, formatDate } from "./covered";
2
-
3
- describe("covered", () => {
4
- it("formats name", () => {
5
- expect(formatName("John", "Doe")).toBe("John Doe");
6
- });
7
-
8
- it("formats date", () => {
9
- const date = new Date("2024-01-01");
10
- expect(formatDate(date)).toContain("2024");
11
- });
12
- });
@@ -1,11 +0,0 @@
1
- /**
2
- * Well-covered utility (90% coverage)
3
- */
4
-
5
- export function formatName(first: string, last: string): string {
6
- return `${first} ${last}`;
7
- }
8
-
9
- export function formatDate(date: Date): string {
10
- return date.toISOString();
11
- }
@@ -1,8 +0,0 @@
1
- import { calculateTotal } from "./uncovered";
2
-
3
- describe("uncovered", () => {
4
- it("calculates total", () => {
5
- expect(calculateTotal([1, 2, 3])).toBe(6);
6
- });
7
- // Note: calculateAverage, calculateMax, calculateMin are NOT tested
8
- });
@@ -1,28 +0,0 @@
1
- /**
2
- * Poorly-covered utility (40% coverage)
3
- */
4
-
5
- export function calculateTotal(items: number[]): number {
6
- return items.reduce((sum, item) => sum + item, 0);
7
- }
8
-
9
- export function calculateAverage(items: number[]): number {
10
- if (items.length === 0) {
11
- return 0;
12
- }
13
- return calculateTotal(items) / items.length;
14
- }
15
-
16
- export function calculateMax(items: number[]): number {
17
- if (items.length === 0) {
18
- return 0;
19
- }
20
- return Math.max(...items);
21
- }
22
-
23
- export function calculateMin(items: number[]): number {
24
- if (items.length === 0) {
25
- return 0;
26
- }
27
- return Math.min(...items);
28
- }