feat: add support for .mjs config#9431
Conversation
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| export const PACKAGE_JSON = 'package.json'; |
There was a problem hiding this comment.
this was essentially a duplicate of the file in jest-config, so I just exported it from there and deleted this
| ? projects[0] === realpath(process.cwd()) | ||
| : projects[0] === process.cwd(); | ||
|
|
||
| const parsedConfigs = projects |
There was a problem hiding this comment.
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.
afaik there's no clean way of detecting support for import function before trying to use it. I think this is fine, though
| // Break circular dependency | ||
| const Runtime: any = require('..'); | ||
|
|
||
| (Runtime.createContext(config, { |
There was a problem hiding this comment.
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
readConfigandreadConfigsnow 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