From 2411699b199d441b3ac59684c2d926cc2e42ae78 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sun, 14 Mar 2021 10:44:02 +0100 Subject: [PATCH] feat: support transpiled transformers --- CHANGELOG.md | 2 ++ packages/babel-jest/src/index.ts | 2 +- packages/jest-transform/src/ScriptTransformer.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bddfa129c71..2c18e8419413 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - `[jest-transform]` Add support for transformers written in ESM ([#11163](https://github.com/facebook/jest/pull/11163)) - `[jest-transform]` [**BREAKING**] Do not export `ScriptTransformer` class, instead export the async function `createScriptTransformer` ([#11163](https://github.com/facebook/jest/pull/11163)) - `[jest-transform]` Async code transformations ([#9889](https://github.com/facebook/jest/pull/9889)) +- `[jest-transform]` Support transpiled transformers - `[jest-worker]` Add support for custom task queues and adds a `PriorityQueue` implementation. ([#10921](https://github.com/facebook/jest/pull/10921)) - `[jest-worker]` Add in-order scheduling policy to jest worker ([10902](https://github.com/facebook/jest/pull/10902)) @@ -73,6 +74,7 @@ - `[*]` [**BREAKING**] Add `exports` field to all `package.json`s ([#9921](https://github.com/facebook/jest/pull/9921)) - `[*]` Make it easier for Jest's packages to use the VM escape hatch ([#10824](https://github.com/facebook/jest/pull/10824)) - `[*]` [**BREAKING**] Remove deprecated `mapCoverage` ([#9968](https://github.com/facebook/jest/pull/9968)) +- `[babel-jest]` [**BREAKING**] Migrate to ESM - `[docs]` Correct example using `browser-resolve` ([#11140](https://github.com/facebook/jest/pull/11140)) - `[jest-config]` [**BREAKING**] Remove `enabledTestsMap` config, use `filter` instead ([#10787](https://github.com/facebook/jest/pull/10787)) - `[jest-console]` [**BREAKING**] Move `root` into `config` and take `GlobalConfig` as mandatory parameter for `getConsoleOutput` ([#10126](https://github.com/facebook/jest/pull/10126)) diff --git a/packages/babel-jest/src/index.ts b/packages/babel-jest/src/index.ts index c0bff0b5d336..c7048c37a395 100644 --- a/packages/babel-jest/src/index.ts +++ b/packages/babel-jest/src/index.ts @@ -167,4 +167,4 @@ const transformer: SyncTransformer = { createTransformer, }; -export = transformer; +export default transformer; diff --git a/packages/jest-transform/src/ScriptTransformer.ts b/packages/jest-transform/src/ScriptTransformer.ts index 7ce6c8d1554f..249f72b43188 100644 --- a/packages/jest-transform/src/ScriptTransformer.ts +++ b/packages/jest-transform/src/ScriptTransformer.ts @@ -255,7 +255,7 @@ class ScriptTransformer { let transformer: Transformer; try { - transformer = require(transformPath); + transformer = interopRequireDefault(require(transformPath)).default; } catch (error) { if (error.code === 'ERR_REQUIRE_ESM') { const configUrl = pathToFileURL(transformPath);