-
Notifications
You must be signed in to change notification settings - Fork 458
feat: support tsconfig references #4689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: support tsconfig references #4689
Conversation
3644197
to
c2eee48
Compare
Would you pls add some tests for this change? |
@ahnpnl Absolutely. That is the reason I have left it in draft stage. Thanks. |
c2eee48
to
daec5b7
Compare
@ahnpnl I added an e2e test case covering the tsconfig project references scenario. Please check it out when you can. Thanks! |
@@ -790,7 +790,6 @@ describe('_resolveTsConfig', () => { | |||
expect(conf.options.configFilePath).toBeUndefined() | |||
expect(findConfig).not.toHaveBeenCalled() | |||
expect(readConfig.mock.calls[0][0]).toBe('/foo/tsconfig.bar.json') | |||
expect(parseConfig).not.toHaveBeenCalled() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will now be called to find out if we there are project references in the tsconfig to check.
@@ -918,7 +917,6 @@ describe('_resolveTsConfig', () => { | |||
|
|||
const conf = cs.parsedTsConfig | |||
expect(conf.options.path).toBe(tscfgPathStub) | |||
expect(findConfig).not.toHaveBeenCalled() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will now be called to find out if we there are project references in the tsconfig to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR implements support for tsconfig project references by enhancing the tsconfig resolution and parsing logic in the configuration module while adding additional Jest configuration files for ESM and CJS compatibility.
- Updated configuration resolution in src/legacy/config/config-set.ts to recursively resolve tsconfig references.
- Added new Jest configuration files for both compiler and transpiler modes with ESM and CJS support in the e2e/tsconfig-projects directory.
- Updated tests in config-set.spec.ts and provided a minimal test and implementation for foo functionality.
Reviewed Changes
File | Description |
---|---|
e2e/tsconfig-projects/src/foo.spec.ts | Added basic test spec for foo. |
e2e/tsconfig-projects/jest-compiler-esm.config.ts | Added Jest ESM configuration for compiler. |
e2e/tsconfig-projects/jest-transpiler-esm.config.ts | Added Jest ESM configuration for transpiler. |
e2e/tsconfig-projects/jest-compiler-cjs.config.ts | Added Jest CJS configuration for compiler. |
e2e/tsconfig-projects/jest-transpiler-cjs.config.ts | Added Jest CJS configuration for transpiler. |
src/legacy/config/config-set.ts | Refactored tsconfig resolution to support project references. |
e2e/tsconfig-projects/src/foo.ts | Updated foo to be an exported function. |
src/legacy/config/config-set.spec.ts | Adjusted tests in accordance with the new tsconfig resolution logic. |
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Pull Request Test Coverage Report for Build 13685876864Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Through this change, we restrict the use of jest globals in the shared source file of the monorepo-app, while allowing them in test files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR adds support for tsconfig references, enabling the tool to resolve project references and verify test files across projects.
- Implements logic to traverse tsconfig project references and validate files using the isTestFile() check.
- Introduces several new Jest configuration files to support both ESM and CJS setups.
- Adds a basic test and corresponding source file for the foo function.
Reviewed Changes
File | Description |
---|---|
e2e/tsconfig-projects/src/foo.spec.ts | Adds a basic test for the exported foo function. |
e2e/tsconfig-projects/jest-compiler-esm.config.ts | Adds Jest configuration for ESM via compiler. |
e2e/tsconfig-projects/jest-transpiler-esm.config.ts | Adds Jest configuration for ESM via transpiler. |
e2e/tsconfig-projects/jest-compiler-cjs.config.ts | Adds Jest configuration for CJS via compiler. |
e2e/tsconfig-projects/jest-transpiler-cjs.config.ts | Adds Jest configuration for CJS via transpiler. |
e2e/tsconfig-projects/src/foo.ts | Exports the foo function. |
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
e2e/tsconfig-projects/src/foo.spec.ts:1
- The new tsconfig references behavior is not explicitly covered by tests. Consider adding tests that exercise the traversal of project references and validate the isTestFile() check in a dedicated test file.
import { foo } from './foo'
@kulshekhar Please review once. This supports typescript project references for |
Hi @sushruth would you pls sync with |
…erence Co-authored-by: Copilot <[email protected]>
fe0fbb9
to
d0d9136
Compare
|
Summary
Fixes #1648 -
isTestFile()
check.isTestFile()
check.Test plan
TODO
Does this PR introduce a breaking change?
Other information