Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions __tests__/resume-integration.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ describe('Resume Builder Integration Tests', () => {
title: 'Personal Information',
order: 0,
visible: true,
content: {},
content: {
full_name: '',
email: '',
phone: '',
location: '',
},
},
{
id: 'section-2',
Expand Down Expand Up @@ -238,7 +243,12 @@ describe('Resume Builder Integration Tests', () => {
title: 'Personal Information',
order: 0,
visible: true,
content: {},
content: {
full_name: '',
email: '',
phone: '',
location: '',
},
},
{
id: 'section-2',
Expand Down
34 changes: 34 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/// <reference types="@testing-library/jest-dom" />

import '@testing-library/jest-dom';

declare global {
namespace jest {
interface Matchers<R = void> {
toBeInTheDocument(): R;
toBeVisible(): R;
toBeEmpty(): R;
toBeEmptyDOMElement(): R;
toBeDisabled(): R;
toBeEnabled(): R;
toBeInvalid(): R;
toBeRequired(): R;
toBeValid(): R;
toContainElement(element: HTMLElement | SVGElement | null): R;
toContainHTML(htmlText: string): R;
toHaveAccessibleDescription(expectedAccessibleDescription?: string | RegExp): R;
toHaveAccessibleName(expectedAccessibleName?: string | RegExp): R;
toHaveAttribute(attr: string, value?: unknown): R;
toHaveClass(...classNames: string[]): R;
toHaveFocus(): R;
toHaveFormValues(expectedValues: Record<string, unknown>): R;
toHaveStyle(css: string | Record<string, unknown>): R;
toHaveTextContent(text: string | RegExp, options?: { normalizeWhitespace: boolean }): R;
toHaveValue(value?: string | string[] | number | null): R;
toHaveDisplayValue(value: string | RegExp | Array<string | RegExp>): R;
toBeChecked(): R;
toBePartiallyChecked(): R;
toHaveErrorMessage(text: string | RegExp): R;
}
}
}
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"types": ["@testing-library/jest-dom"],
"plugins": [
{
"name": "next"
Expand All @@ -23,6 +24,6 @@
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules", "backup-old-cache-files"]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "types/**/*.d.ts"],
"exclude": ["node_modules", "backup-old-cache-files", "**/*.test.ts", "**/*.test.tsx", "__tests__/**/*"]
}
Comment on lines +27 to 29
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Tests are excluded from type-checking; this contradicts the PR goal.

Excluding "/.test." and "tests/" prevents tsc from validating tests. Either:

  • Keep excludes here but introduce tsconfig.test.json (recommended), or
  • Remove the test excludes to type-check tests in the main pass.

Suggested change (if you keep a separate tsconfig.test.json):

-  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "types/**/*.d.ts"],
-  "exclude": ["node_modules", "backup-old-cache-files", "**/*.test.ts", "**/*.test.tsx", "__tests__/**/*"]
+  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "types/**/*.d.ts"],
+  "exclude": ["node_modules", "backup-old-cache-files"]

Note: global.d.ts at repo root is not matched by current include; either delete it (see below) or move it under types/.


🏁 Script executed:

#!/bin/bash
# Verify include/exclude expectations
jq -r '.include, .exclude' tsconfig.json

Length of output: 200


I need to gather more information about the repository context and PR goal before finalizing the review.





🏁 Script executed:

#!/bin/bash
# Check for global.d.ts at repo root
fd -d 1 "global\.d\.ts$" .

# Check for existing test tsconfig files
fd "tsconfig.*test.*\.json$" .

# Check overall tsconfig files
fd "tsconfig.*\.json$" . | head -20

Length of output: 29


🏁 Script executed:

#!/bin/bash
# Check for PR description/goal
gh pr view --json body,title -q '.title, .body' 2>/dev/null || echo "PR context not available"

Length of output: 24


Need to verify glob pattern behavior and check git history for context.




🏁 Script executed:

#!/bin/bash
# Verify glob pattern matching
cd . && node -e "
const glob = require('glob').glob;
const sync = require('glob').globSync;
try {
  const matches = sync('**/*.d.ts', { cwd: '.', ignore: 'node_modules/**' });
  console.log('Matched .d.ts files:');
  console.log(matches.slice(0, 20));
} catch(e) {
  console.log('glob module not available, trying simple check');
}
"

# Direct check: is global.d.ts treated as matching **/*.d.ts?
ls -la ./global.d.ts 2>/dev/null && echo "global.d.ts exists"

# Check for test config in package.json and other files
cat package.json 2>/dev/null | jq '.jest, .vitest, .scripts' 2>/dev/null || echo "package.json not found"

# Check for separate test configs
fd "jest\.config|vitest\.config" .

Length of output: 3554


🏁 Script executed:

#!/bin/bash
# Check git history of tsconfig.json
git log --oneline -n 20 -- tsconfig.json 2>/dev/null || echo "Git history not available"

# Check git diff to see what changed
git diff HEAD~1 tsconfig.json 2>/dev/null || echo "Git diff not available"

Length of output: 878


Need one final check on jest configuration to understand intent.


---

🏁 Script executed:

```shell
#!/bin/bash
# Check jest.config.js for type handling
cat jest.config.js | head -50

# Check if there are any TypeScript preset configurations
grep -i "preset\|ts-jest\|transform" jest.config.js || echo "No preset found"

# Verify types directory structure
fd "\.d\.ts$" types/ 2>/dev/null | head -10

Length of output: 931


Tests are excluded from type-checking; this contradicts the PR goal.

The git history confirms this PR added the test excludes ("/*.test.ts", "/.test.tsx", "tests/**/") while claiming to "Add Jest DOM type definitions and testing configuration." Excluding tests from the main tsconfig contradicts that goal.

Additionally, global.d.ts at the repo root is not matched by the current include patterns (which only includes "types/**/*.d.ts").

Either:

  • Remove the test excludes to type-check tests in the main pass, or
  • Create a separate tsconfig.test.json and remove test excludes from the main config

Also move or delete global.d.ts, or add a pattern to include root-level .d.ts files.

🤖 Prompt for AI Agents
In tsconfig.json around lines 27 to 29, the config currently excludes test files
("**/*.test.ts", "**/*.test.tsx", "__tests__/**/*") which contradicts this PR's
goal to type-check tests and also the repo root global.d.ts is not matched by
the current include patterns; fix by either removing the test-related patterns
from "exclude" so tests are included in the main type-check pass, or create a
separate tsconfig.test.json for tests and remove the test excludes from the main
tsconfig while configuring your test tsconfig to extend the base and include
tests, and ensure global.d.ts is discoverable by either moving it into the
included "types/" folder or by adding a glob (for example "*.d.ts" or
"./global.d.ts") to the "include" array in tsconfig.json.

33 changes: 33 additions & 0 deletions types/jest-dom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/// <reference types="@testing-library/jest-dom" />

import '@testing-library/jest-dom';
import type * as jestGlobals from '@jest/globals';

declare module '@jest/globals' {
interface Matchers<R = void> extends jestGlobals.Matchers<R> {
toBeInTheDocument(): R;
toBeVisible(): R;
toBeEmpty(): R;
toBeEmptyDOMElement(): R;
toBeDisabled(): R;
toBeEnabled(): R;
toBeInvalid(): R;
toBeRequired(): R;
toBeValid(): R;
toContainElement(element: HTMLElement | SVGElement | null): R;
toContainHTML(htmlText: string): R;
toHaveAccessibleDescription(expectedAccessibleDescription?: string | RegExp): R;
toHaveAccessibleName(expectedAccessibleName?: string | RegExp): R;
toHaveAttribute(attr: string, value?: unknown): R;
toHaveClass(...classNames: string[]): R;
toHaveFocus(): R;
toHaveFormValues(expectedValues: Record<string, unknown>): R;
toHaveStyle(css: string | Record<string, unknown>): R;
toHaveTextContent(text: string | RegExp, options?: { normalizeWhitespace: boolean }): R;
toHaveValue(value?: string | string[] | number | null): R;
toHaveDisplayValue(value: string | RegExp | Array<string | RegExp>): R;
toBeChecked(): R;
toBePartiallyChecked(): R;
toHaveErrorMessage(text: string | RegExp): R;
}
}
Loading