-
-
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: add support for .mjs config #9431
Conversation
packages/jest-cli/src/init/__tests__/__snapshots__/init.test.js.snap
Outdated
Show resolved
Hide resolved
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
export const PACKAGE_JSON = 'package.json'; |
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 was essentially a duplicate of the file in jest-config
, so I just exported it from there and deleted this
@@ -298,33 +299,37 @@ export function readConfigs( | |||
? projects[0] === realpath(process.cwd()) | |||
: projects[0] === process.cwd(); | |||
|
|||
const parsedConfigs = projects |
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.
ignore whitespace - I just wrapped the old array in await Promise.all
|
||
configObject = importedConfig.default; | ||
} catch (error) { | ||
if (error.message === 'Not supported') { |
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.
afaik there's no clean way of detecting support for import
function before trying to use it. I think this is fine, though
@@ -73,26 +73,26 @@ export function run(cliArgv?: Config.Argv, cliInfo?: Array<string>) { | |||
// Break circular dependency | |||
const Runtime: any = require('..'); | |||
|
|||
(Runtime.createContext(config, { |
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.
ignore whitespace, I just unwrapped .then().catch()
to async-await
Codecov Report
@@ Coverage Diff @@
## master #9431 +/- ##
=========================================
- Coverage 65.06% 64.97% -0.1%
=========================================
Files 283 283
Lines 12088 12099 +11
Branches 2983 2989 +6
=========================================
- Hits 7865 7861 -4
- Misses 3588 3602 +14
- Partials 635 636 +1
Continue to review full report at Codecov.
|
Need to land so it goes into 25. It's a new feature, so if there's something broken here it won't break anyone |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This fixes #9225. It is a breaking change since
readConfig
andreadConfigs
now return promises. The error isn't too good on older versions of node, but I think that's fine.Test plan
Tests added, although they only run on node 13