Skip to content

exclude __tests__ from tsc#2628

Open
Skidy89 wants to merge 1 commit into
WhiskeySockets:masterfrom
Skidy89:patch-4
Open

exclude __tests__ from tsc#2628
Skidy89 wants to merge 1 commit into
WhiskeySockets:masterfrom
Skidy89:patch-4

Conversation

@Skidy89

@Skidy89 Skidy89 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

without this, tsc goes crazy, as detects tests as a typescript directory. excluding it will make tsc compile the current code without errors


Summary by cubic

Exclude src/__tests__/** from TypeScript compilation so tsc no longer treats test files as source. This stops false type errors from tests and lets builds pass.

Written for commit f6d3f2f. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Chores
    • Updated TypeScript configuration to exclude test directories from compilation.

@whiskeysockets-bot

Copy link
Copy Markdown
Contributor

Thanks for opening this pull request and contributing to the project!

The next step is for the maintainers to review your changes. If everything looks good, it will be approved and merged into the main branch.

In the meantime, anyone in the community is encouraged to test this pull request and provide feedback.

✅ How to confirm it works

If you’ve tested this PR, please comment below with:

Tested and working ✅

This helps us speed up the review and merge process.

📦 To test this PR locally:

# NPM
npm install @whiskeysockets/baileys@Skidy89/Baileys-fork#patch-4

# Yarn (v2+)
yarn add @whiskeysockets/baileys@Skidy89/Baileys-fork#patch-4

# PNPM
pnpm add @whiskeysockets/baileys@Skidy89/Baileys-fork#patch-4

If you encounter any issues or have feedback, feel free to comment as well.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR modifies tsconfig.json to exclude test files under src/__tests__/** from TypeScript compilation, preventing test code from being included in the compiled output alongside the main node_modules exclusion.

Changes

TypeScript Build Configuration

Layer / File(s) Summary
TypeScript test exclusion configuration
tsconfig.json
The exclude list is updated to explicitly omit src/__tests__/** from compilation in addition to the existing node_modules exclusion.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 One line hops in, tests now skip the compile,
TypeScript's exclude list grows just a trifle,
src/__tests__ won't slow the build race—
A clean config keeps everything in place!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'exclude tests from tsc' directly and clearly describes the main change: excluding the tests directory from TypeScript compilation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 `@tsconfig.json`:
- Line 38: The tsconfig.json currently excludes "src/__tests__/**", which breaks
type-aware ESLint because parserOptions.project points at tsconfig.json while
lint targets src/**/*.ts; create a separate ESLint TS config (e.g.,
tsconfig.eslint.json) that extends "./tsconfig.json", sets "include":
["src/**/*.ts"] and removes the tests exclusion (keep only "node_modules" in
"exclude"), then update ESLint's parserOptions.project to point to this new
tsconfig so tests are included for linting while the original tsconfig keeps the
exclusion for tsc.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fe96c026-cc8c-4c5e-adfa-71f1125c9162

📥 Commits

Reviewing files that changed from the base of the PR and between 78e7e4e and f6d3f2f.

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

Comment thread tsconfig.json
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "src/__tests__/**"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Type-aware ESLint will likely break for test files with this exclusion.

Because ESLint uses parserOptions.project: "./tsconfig.json" while lint targets src/**/*.ts, excluding src/__tests__/** here can cause parser project-inclusion errors on test files during npm run lint. Keep this exclusion for tsc, but add a dedicated ESLint tsconfig that includes tests (or point ESLint to a separate project file).

Suggested config split
# tsconfig.json (typecheck/build)
 "exclude": ["node_modules", "src/__tests__/**"]
// tsconfig.eslint.json (new)
{
  "extends": "./tsconfig.json",
  "include": ["src/**/*.ts"],
  "exclude": ["node_modules"]
}
# eslint.config.mts
 parserOptions: {
-  project: "./tsconfig.json",
+  project: "./tsconfig.eslint.json",
 },
🤖 Prompt for 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.

In `@tsconfig.json` at line 38, The tsconfig.json currently excludes
"src/__tests__/**", which breaks type-aware ESLint because parserOptions.project
points at tsconfig.json while lint targets src/**/*.ts; create a separate ESLint
TS config (e.g., tsconfig.eslint.json) that extends "./tsconfig.json", sets
"include": ["src/**/*.ts"] and removes the tests exclusion (keep only
"node_modules" in "exclude"), then update ESLint's parserOptions.project to
point to this new tsconfig so tests are included for linting while the original
tsconfig keeps the exclusion for tsc.

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

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.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tsconfig.json">

<violation number="1" location="tsconfig.json:38">
P2: Excluding `src/__tests__/**` from tsconfig.json will break type-aware ESLint linting for test files if ESLint is configured with `parserOptions.project` pointing to this tsconfig. Files excluded from the tsconfig cannot be parsed by typescript-eslint's type-aware rules, resulting in "TSConfig does not include this file" errors.

Consider creating a separate `tsconfig.eslint.json` that extends this config but removes the test exclusion, and point ESLint's `parserOptions.project` at it instead.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tsconfig.json
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "src/__tests__/**"]

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.

P2: Excluding src/__tests__/** from tsconfig.json will break type-aware ESLint linting for test files if ESLint is configured with parserOptions.project pointing to this tsconfig. Files excluded from the tsconfig cannot be parsed by typescript-eslint's type-aware rules, resulting in "TSConfig does not include this file" errors.

Consider creating a separate tsconfig.eslint.json that extends this config but removes the test exclusion, and point ESLint's parserOptions.project at it instead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tsconfig.json, line 38:

<comment>Excluding `src/__tests__/**` from tsconfig.json will break type-aware ESLint linting for test files if ESLint is configured with `parserOptions.project` pointing to this tsconfig. Files excluded from the tsconfig cannot be parsed by typescript-eslint's type-aware rules, resulting in "TSConfig does not include this file" errors.

Consider creating a separate `tsconfig.eslint.json` that extends this config but removes the test exclusion, and point ESLint's `parserOptions.project` at it instead.</comment>

<file context>
@@ -35,5 +35,5 @@
   },
   "include": ["src/**/*.ts"],
-  "exclude": ["node_modules"]
+  "exclude": ["node_modules", "src/__tests__/**"]
 }
</file context>

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants