Skip to content

fix(build): resolve TypeScript 6.0.3 migration CI failures#545

Open
hieuck wants to merge 4 commits into
mainfrom
fix/typescript-6-migration-checks
Open

fix(build): resolve TypeScript 6.0.3 migration CI failures#545
hieuck wants to merge 4 commits into
mainfrom
fix/typescript-6-migration-checks

Conversation

@hieuck

@hieuck hieuck commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the CI failures blocking the TypeScript 6.0.3 bump in #277 so the upgrade can land safely.

Root causes

  1. jest.config.js inline tsconfig used ignoreDeprecations: "5.0", which TypeScript 6.0 does not accept for the new baseUrl / moduleResolution=node10 deprecation warnings.
  2. packages/validation/tsconfig.json and packages/types/tsconfig.json included __tests__ and did not exclude *.spec.ts / *.test.ts, so the Docker build tsc step failed with missing Jest global types.
  3. packages/hooks/tsconfig.build.json only excluded __tests__ and was inconsistent with other package build configs.
  4. scripts/__tests__/workspace-manifests.test.js still asserted the old TypeScript 5.9.3 values.

Changes

  • jest.config.js: ignoreDeprecations 5.06.0
  • packages/validation/tsconfig.json: exclude __tests__, **/*.spec.ts, **/*.test.ts
  • packages/types/tsconfig.json: exclude __tests__, **/*.spec.ts, **/*.test.ts
  • packages/hooks/tsconfig.build.json: exclude **/*.spec.ts, **/*.test.ts
  • scripts/__tests__/workspace-manifests.test.js: update assertions to TypeScript 6.0.3 values

Verification

  • pnpm test — 399/399 suites passed, 2416/2416 tests passed
  • pnpm qa:commit — all quality gates passed
  • pnpm type-check — all workspaces type-checked successfully
  • docker build -t smart-erp-next:ts6-check . — image built successfully

Supersedes and closes #277.

Summary by CodeRabbit

  • Chores

    • Updated the project’s TypeScript tooling to version 6.0.3.
    • Updated compiler and test settings for TypeScript 6 compatibility.
    • Improved build configuration to exclude test files from compiled output.
    • Updated module handling to support Node16 conventions.
  • Tests

    • Refreshed configuration checks to align with the updated TypeScript version.

dependabot Bot and others added 4 commits July 6, 2026 08:07
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.9.3 to 6.0.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Commits](microsoft/TypeScript@v5.9.3...v6.0.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 6.0.3
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…pt-6.0.3' into fix/typescript-6-migration-checks
- Update jest.config.js inline tsconfig ignoreDeprecations from 5.0 to 6.0
- Exclude test files from validation/types package build tsconfigs
- Add spec/test excludes to hooks tsconfig.build.json for consistency
- Update workspace-manifests test assertions for TypeScript 6.0.3
@ecc-tools

ecc-tools Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file api web database schema ci tests labels Jul 10, 2026
Comment thread jest.config.js
emitDecoratorMetadata: false,
experimentalDecorators: true,
ignoreDeprecations: '5.0',
ignoreDeprecations: '6.0',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The ignoreDeprecations option is not a valid TypeScript compiler option and will be ignored by ts-jest and TypeScript. This setting is likely intended for Node.js or another tool. To avoid confusion and ensure maintainability, remove this option from the tsconfig section and, if necessary, set it in the appropriate configuration (e.g., Node.js runtime flags).

Recommended change:

// Remove this line from the tsconfig section
// ignoreDeprecations: '6.0',

Comment on lines 18 to 28
const jestConfig = require(path.join(repoRoot, 'jest.config.js'));
const transform = jestConfig.transform['^.+\\.(ts|tsx|js|jsx)$'];

expect(transform[1].tsconfig.ignoreDeprecations).toBe('5.0');
expect(transform[1].tsconfig.ignoreDeprecations).toBe('6.0');
});

it('declares a root TypeScript version for Jest transforms', () => {
const manifest = readJson('package.json');

expect(manifest.devDependencies).toHaveProperty('typescript', '5.9.3');
expect(manifest.devDependencies).toHaveProperty('typescript', '6.0.3');
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These tests assume that configuration files (e.g., jest.config.js, package.json) and their internal structures are always present and valid. If these files are missing or their structure changes, the tests will throw runtime errors rather than failing gracefully. Consider adding checks to ensure the files and expected properties exist before making assertions, so test failures are informative and not due to uncaught exceptions.

Comment on lines 18 to 28
const jestConfig = require(path.join(repoRoot, 'jest.config.js'));
const transform = jestConfig.transform['^.+\\.(ts|tsx|js|jsx)$'];

expect(transform[1].tsconfig.ignoreDeprecations).toBe('5.0');
expect(transform[1].tsconfig.ignoreDeprecations).toBe('6.0');
});

it('declares a root TypeScript version for Jest transforms', () => {
const manifest = readJson('package.json');

expect(manifest.devDependencies).toHaveProperty('typescript', '5.9.3');
expect(manifest.devDependencies).toHaveProperty('typescript', '6.0.3');
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The tests are tightly coupled to specific configuration values (e.g., TypeScript version '6.0.3', Jest transform settings). This can make the tests brittle and require frequent updates as configuration changes. Consider parameterizing these values or documenting the rationale for hardcoding them to improve maintainability.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

TypeScript is upgraded from 5.9.3 to 6.0.3 across workspace packages. Compiler deprecation settings, Node16 module configuration, test-file exclusions, and related Jest manifest assertions are updated.

Changes

TypeScript 6 migration

Layer / File(s) Summary
Workspace TypeScript versions
package.json, apps/*/package.json, packages/*/package.json
Workspace development dependencies update TypeScript to 6.0.3.
Compiler and Jest compatibility
packages/config-typescript/base.json, jest.config.js, scripts/__tests__/workspace-manifests.test.js
Deprecation settings and corresponding test expectations change from 5.0 to 6.0.
Module and test-file build configuration
packages/shared/tsconfig.json, packages/*/tsconfig*.json
Shared compilation uses Node16 module settings, and package builds exclude specification and test files.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 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 clearly summarizes the TypeScript 6.0.3 migration and related CI fixes.
Linked Issues check ✅ Passed The changes update TypeScript to 6.0.3 across the workspace, matching the linked bump request.
Out of Scope Changes check ✅ Passed No clearly unrelated changes are shown; the module-resolution and test/build config updates support the TypeScript migration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/typescript-6-migration-checks

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.

@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

🧹 Nitpick comments (1)
packages/validation/tsconfig.json (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

__tests__ appears in both include and exclude, making the include entry ineffective.

TypeScript's exclude takes precedence over include, so the __tests__ directory is fully excluded from compilation despite being listed in include. This contradiction was introduced by adding __tests__ to the exclude array. Either remove "__tests__" from include if tests should be excluded, or remove it from exclude if tests should be type-checked.

♻️ Proposed fix (assuming tests should be excluded from this config)
-{"extends":"../config-typescript/base.json","compilerOptions":{"lib":["ES2022"],"outDir":"./dist","rootDir":"."},"include":["src","__tests__"],"exclude":["node_modules","dist","__tests__","**/*.spec.ts","**/*.test.ts"]}
+{"extends":"../config-typescript/base.json","compilerOptions":{"lib":["ES2022"],"outDir":"./dist","rootDir":"."},"include":["src"],"exclude":["node_modules","dist","__tests__","**/*.spec.ts","**/*.test.ts"]}
🤖 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 `@packages/validation/tsconfig.json` at line 1, Resolve the contradictory
TypeScript configuration in the validation package’s tsconfig: choose whether
tests should be compiled, then remove "__tests__" from either the include or
exclude array accordingly. Based on the review’s proposed assumption, remove
"__tests__" from include while keeping it excluded.
🤖 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 `@packages/types/tsconfig.json`:
- Line 1: Resolve the contradictory test configuration in the package TypeScript
configs. In tsconfig.json, preserve test type-checking by removing __tests__ and
test-file patterns from exclude; if build-only exclusions are required, add a
separate tsconfig.build.json extending tsconfig.json with include set to src and
the existing test exclusions. At minimum, remove __tests__ from include if the
current exclusion strategy is intentional.

---

Nitpick comments:
In `@packages/validation/tsconfig.json`:
- Line 1: Resolve the contradictory TypeScript configuration in the validation
package’s tsconfig: choose whether tests should be compiled, then remove
"__tests__" from either the include or exclude array accordingly. Based on the
review’s proposed assumption, remove "__tests__" from include while keeping it
excluded.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bd1fa0fd-4615-4fa8-9a0a-612f44b40e79

📥 Commits

Reviewing files that changed from the base of the PR and between 7dc3e9c and 2d030ca.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • apps/api/package.json
  • apps/web/package.json
  • jest.config.js
  • package.json
  • packages/accounting/package.json
  • packages/config-eslint/package.json
  • packages/config-typescript/base.json
  • packages/database/package.json
  • packages/hooks/package.json
  • packages/hooks/tsconfig.build.json
  • packages/shared/package.json
  • packages/shared/tsconfig.json
  • packages/sync/package.json
  • packages/types/package.json
  • packages/types/tsconfig.json
  • packages/utils/package.json
  • packages/utils/tsconfig.build.json
  • packages/validation/package.json
  • packages/validation/tsconfig.json
  • scripts/__tests__/workspace-manifests.test.js

@@ -1,2 +1,2 @@
{"extends":"../config-typescript/base.json","compilerOptions":{"lib":["ES2022"],"outDir":"./dist","rootDir":"."},"include":["src","__tests__"],"exclude":["node_modules","dist"]}
{"extends":"../config-typescript/base.json","compilerOptions":{"lib":["ES2022"],"outDir":"./dist","rootDir":"."},"include":["src","__tests__"],"exclude":["node_modules","dist","__tests__","**/*.spec.ts","**/*.test.ts"]}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Contradictory include and exclude for __tests__.

"__tests__" appears in both the include array (["src", "__tests__"]) and the exclude array. In TypeScript, exclude filters files matched by include, so __tests__ is effectively excluded — but listing it in include is contradictory and misleading.

Additionally, unlike packages/hooks which uses a separate tsconfig.build.json for build-time test exclusions, this is the base tsconfig.json. Excluding __tests__ and test files here means they will not be type-checked by the IDE or tsc --noEmit. If a separate tsconfig.build.json exists for the types package, these exclusions should live there instead. If not, test files lose type-checking coverage.

🔧 Proposed fix

If this is the only config (no separate build config), remove test exclusions to keep type checking, and create a tsconfig.build.json instead:

-{"extends":"../config-typescript/base.json","compilerOptions":{"lib":["ES2022"],"outDir":"./dist","rootDir":"."},"include":["src","__tests__"],"exclude":["node_modules","dist","__tests__","**/*.spec.ts","**/*.test.ts"]}
+{"extends":"../config-typescript/base.json","compilerOptions":{"lib":["ES2022"],"outDir":"./dist","rootDir":"."},"include":["src","__tests__"],"exclude":["node_modules","dist"]}

Then create packages/types/tsconfig.build.json:

{
  "extends": "./tsconfig.json",
  "include": ["src"],
  "exclude": ["node_modules", "dist", "__tests__", "**/*.spec.ts", "**/*.test.ts"]
}

If the intent is to exclude test files from this single config, at minimum remove "__tests__" from include to eliminate the contradiction:

-"include":["src","__tests__"]
+"include":["src"]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{"extends":"../config-typescript/base.json","compilerOptions":{"lib":["ES2022"],"outDir":"./dist","rootDir":"."},"include":["src","__tests__"],"exclude":["node_modules","dist","__tests__","**/*.spec.ts","**/*.test.ts"]}
{"extends":"../config-typescript/base.json","compilerOptions":{"lib":["ES2022"],"outDir":"./dist","rootDir":"."},"include":["src","__tests__"],"exclude":["node_modules","dist"]}
🤖 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 `@packages/types/tsconfig.json` at line 1, Resolve the contradictory test
configuration in the package TypeScript configs. In tsconfig.json, preserve test
type-checking by removing __tests__ and test-file patterns from exclude; if
build-only exclusions are required, add a separate tsconfig.build.json extending
tsconfig.json with include set to src and the existing test exclusions. At
minimum, remove __tests__ from include if the current exclusion strategy is
intentional.

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

Labels

api ci database dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation schema tests web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant