From 3512f5726b8bbe8522bb1301a9b5646385dfc227 Mon Sep 17 00:00:00 2001 From: Michael Loughry Date: Fri, 5 Apr 2019 12:13:45 -0700 Subject: [PATCH] Allow JSON transforms for #2578 --- packages/jest-runtime/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/jest-runtime/src/index.ts b/packages/jest-runtime/src/index.ts index 86e7115f9860..81e676968009 100644 --- a/packages/jest-runtime/src/index.ts +++ b/packages/jest-runtime/src/index.ts @@ -464,7 +464,11 @@ class Runtime { options: InternalModuleOptions | undefined, moduleRegistry: ModuleRegistry, ) { - if (path.extname(modulePath) === '.json') { + if ( + path.extname(modulePath) === '.json' && + options && + options.isInternalModule + ) { localModule.exports = this._environment.global.JSON.parse( stripBOM(fs.readFileSync(modulePath, 'utf8')), );