-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
22 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 11 additions & 6 deletions
17
packages/gatsby/src/utils/worker/__tests__/test-helpers/wrapper-for-tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
// spawned process won't use jest config to support TS, so we need to add support ourselves | ||
require(`@babel/register`)({ | ||
extensions: [`.js`, `.ts`], | ||
configFile: require.resolve(`../../../../../babel.config.js`), | ||
ignore: [/node_modules/], | ||
}) | ||
// this IS executed in process that spawn worker to analyze exports and create functions for them on worker pool object | ||
// so we want to use `@babel/register` ONLY inside actual worker as otherwise it does mess with jest transformation and tools like `rewire` | ||
// see `./create-test-worker.ts` file for explanation why this env var is used. | ||
if (process.env.JEST_WORKER_ID) { | ||
// spawned process won't use jest config to support TS, so we need to add support ourselves | ||
require(`@babel/register`)({ | ||
extensions: [`.js`, `.ts`], | ||
configFile: require.resolve(`../../../../../babel.config.js`), | ||
ignore: [/node_modules/], | ||
}) | ||
} | ||
|
||
module.exports = require(`./child-for-tests`) |