-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
feat(jest-config): Support using esbuild-register for loading TS configs #13742
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @jest-config-loader esbuild-register | ||
*/ | ||
export default { | ||
jestConfig: 'jest.config.ts', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a type annotation? Currently this file is valid JS There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, done in 66e69a1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, not sure why using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can’t find the exact failure, but this note could be helpful. Only one job in CI builds types, all other tests run without types being build. So if you import some type from Integration tests for https://github.com/facebook/jest/blob/d2420aaf42055097dfe1e6a54bf3701214b06402/jest.config.mjs#L67 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, interesting. Should I add testcases to For reference:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yes please 👍 |
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,16 @@ | |
}, | ||
"peerDependencies": { | ||
"@types/node": "*", | ||
"esbuild-register": ">=3.1.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we could resolve from the context if the config file and avoid the peer dep? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I follow what you mean here. My view was that this was documenting optional dependencies which can add additional functionality for jest-config, but I think could just totally remove it without it affecting the code at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Taking a step back, we need the peer dep so that we can do However, since I wanna change this in a future major so that we don't have to hard code support for modules in Jest, I think the current approach is fine for now 👍 |
||
"ts-node": ">=9.0.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@types/node": { | ||
"optional": true | ||
}, | ||
"esbuild-register": { | ||
"optional": true | ||
}, | ||
"ts-node": { | ||
"optional": true | ||
} | ||
|
@@ -39,6 +43,7 @@ | |
"glob": "^7.1.3", | ||
"graceful-fs": "^4.2.9", | ||
"jest-circus": "workspace:^", | ||
"jest-docblock": "workspace:^", | ||
"jest-environment-node": "workspace:^", | ||
"jest-get-type": "workspace:^", | ||
"jest-regex-util": "workspace:^", | ||
|
@@ -57,6 +62,8 @@ | |
"@types/graceful-fs": "^4.1.3", | ||
"@types/micromatch": "^4.0.1", | ||
"@types/parse-json": "^4.0.0", | ||
"esbuild": "^0.15.0", | ||
"esbuild-register": "^3.1.0", | ||
"semver": "^7.3.5", | ||
"ts-node": "^10.5.0", | ||
"typescript": "^4.8.2" | ||
|
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.
should we have an example of a docblock? in case folks don't know what it is