From acb43e5a98e3a70359616472c6914281e4bcb972 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Thu, 29 Oct 2020 09:24:47 +0100 Subject: [PATCH] chore: add failing test --- packages/babel-plugin-jest-hoist/package.json | 1 + .../src/__tests__/hoistPlugin.test.ts | 14 ++++++++++++++ yarn.lock | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/babel-plugin-jest-hoist/package.json b/packages/babel-plugin-jest-hoist/package.json index 5da83c3e267f..b802e6a0fba4 100644 --- a/packages/babel-plugin-jest-hoist/package.json +++ b/packages/babel-plugin-jest-hoist/package.json @@ -20,6 +20,7 @@ }, "devDependencies": { "@babel/core": "^7.11.6", + "@babel/preset-react": "^7.12.1", "@types/babel__template": "^7.0.2", "@types/node": "*", "babel-plugin-tester": "^10.0.0" diff --git a/packages/babel-plugin-jest-hoist/src/__tests__/hoistPlugin.test.ts b/packages/babel-plugin-jest-hoist/src/__tests__/hoistPlugin.test.ts index 1e0554a2958c..70a47f154a47 100644 --- a/packages/babel-plugin-jest-hoist/src/__tests__/hoistPlugin.test.ts +++ b/packages/babel-plugin-jest-hoist/src/__tests__/hoistPlugin.test.ts @@ -13,6 +13,20 @@ pluginTester({ plugin: babelPluginJestHoist, pluginName: 'babel-plugin-jest-hoist', tests: { + 'automatic react runtime': { + babelOptions: { + presets: [ + [ + require.resolve('@babel/preset-react'), + {development: true, runtime: 'automatic'}, + ], + ], + }, + code: ` + jest.mock('./App', () => () =>
Hello world
); + `, + snapshot: true, + }, 'top level mocking': { code: ` require('x'); diff --git a/yarn.lock b/yarn.lock index 6f5f7eece467..5a59dd079da5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1456,7 +1456,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-react@npm:*, @babel/preset-react@npm:^7.0.0, @babel/preset-react@npm:^7.9.4": +"@babel/preset-react@npm:*, @babel/preset-react@npm:^7.0.0, @babel/preset-react@npm:^7.12.1, @babel/preset-react@npm:^7.9.4": version: 7.12.1 resolution: "@babel/preset-react@npm:7.12.1" dependencies: @@ -4830,6 +4830,7 @@ __metadata: resolution: "babel-plugin-jest-hoist@workspace:packages/babel-plugin-jest-hoist" dependencies: "@babel/core": ^7.11.6 + "@babel/preset-react": ^7.12.1 "@babel/template": ^7.3.3 "@babel/types": ^7.3.3 "@types/babel__core": ^7.0.0