Skip to content

feat: add separate tsconfig for test files#4616

Open
devnchill wants to merge 4 commits intoOWASP:mainfrom
devnchill:fix/import
Open

feat: add separate tsconfig for test files#4616
devnchill wants to merge 4 commits intoOWASP:mainfrom
devnchill:fix/import

Conversation

@devnchill
Copy link
Copy Markdown
Contributor

Proposed change

Resolves #4571

Add the PR description here.

tsconfig in frontend/tsconfig.json excludes test directory. this causes for lsp unable to pick up any globals/methods from jest libraries . This pr adds a separate tsconfig.json in frontend/__tests__ .

Checklist

  • Required: I followed the contributing workflow
  • Required: I verified that my code works as intended and resolves the issue as described
  • Required: I ran make check-test locally: all warnings addressed, tests passed
  • I used AI for code, documentation, tests, or communication related to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e6c1ff8d-b072-41a6-96f9-fd0b7dea4ea5

📥 Commits

Reviewing files that changed from the base of the PR and between f3b8948 and 87fd98c.

📒 Files selected for processing (1)
  • frontend/__tests__/tsconfig.json

Summary by CodeRabbit

  • Tests
    • Added TypeScript configuration for test compilation with appropriate compiler options to support the test environment.

Walkthrough

A TypeScript test configuration file was added at frontend/__tests__/tsconfig.json that extends the root config and explicitly declares test framework types (jest, @testing-library/jest-dom, node) to enable proper LSP type recognition in test files.

Changes

Test Configuration Setup

Layer / File(s) Summary
Test TypeScript Config
frontend/__tests__/tsconfig.json
New config file extends root tsconfig, declares jest and @testing-library/jest-dom types, sets noEmit and isolatedModules, and excludes node_modules.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add separate tsconfig for test files' clearly and concisely summarizes the main change, which is the addition of a dedicated TypeScript configuration file for test files.
Description check ✅ Passed The description is directly related to the changeset, explaining that the new tsconfig is added to resolve LSP issues with test files not picking up Jest/testing-library globals.
Linked Issues check ✅ Passed The PR successfully addresses the linked issue #4571 by adding a separate tsconfig.json in frontend/tests to include test files, enabling LSP to recognize Jest/testing-library typings and resolve type errors.
Out of Scope Changes check ✅ Passed The only change is the addition of frontend/tests/tsconfig.json, which is directly within scope of the linked issue objective to configure test files for proper LSP recognition.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@devnchill devnchill marked this pull request as ready for review May 6, 2026 19:37
@devnchill devnchill requested review from arkid15r and kasya as code owners May 6, 2026 19:37
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/__tests__/tsconfig.json`:
- Around line 4-8: Remove the "@testing-library/jest-dom" entry from the
tsconfig "types" array because it causes TS2688 with v6+; instead rely on the
import in jest.setup.ts (configured via setupFilesAfterEnv) which already
provides the globals, so edit the "types" array to omit
"@testing-library/jest-dom" and keep "jest" and "node" intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b0529400-fc0b-489b-b564-5cc6f7b34469

📥 Commits

Reviewing files that changed from the base of the PR and between 45ebaf5 and f3b8948.

📒 Files selected for processing (1)
  • frontend/__tests__/tsconfig.json

Comment thread frontend/__tests__/tsconfig.json
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes May 6, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@devnchill
Copy link
Copy Markdown
Contributor Author

@arkid15r , at the moment the jest scripts in frontend/package.json uses tsconfig.json file in frontend/tsconfig.json ,

    "test:a11y": "NODE_OPTIONS='--experimental-vm-modules --no-warnings=DEP0040' jest __tests__/a11y/ --coverage=false",
    "test:unit": "tsc --noEmit && NODE_OPTIONS='--experimental-vm-modules --no-warnings=DEP0040' jest"

however i was wondering that since tests now have their separate tsconfig, maybe i should provide this as config file for those test ?

@devnchill devnchill marked this pull request as draft May 6, 2026 19:43
@devnchill devnchill marked this pull request as ready for review May 6, 2026 20:00
cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes May 6, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix import in multiple test files

1 participant