Skip to content

chore: Migrate bable-plugin-jest-hoist to Typescript#7898

Merged
SimenB merged 11 commits intojestjs:masterfrom
deneuv34:ts-bable-plugin-jest-hoist
Feb 16, 2019
Merged

chore: Migrate bable-plugin-jest-hoist to Typescript#7898
SimenB merged 11 commits intojestjs:masterfrom
deneuv34:ts-bable-plugin-jest-hoist

Conversation

@deneuv34
Copy link
Copy Markdown
Contributor

@deneuv34 deneuv34 commented Feb 14, 2019

Summary

Migrate babel-plugin-jest-hoist into typescript.

Details
diff --git a/packages/babel-plugin-jest-hoist/build/index.js b/packages/babel-plugin-jest-hoist/build/index.js
index f38181f08..d5d1460ea 100644
--- a/packages/babel-plugin-jest-hoist/build/index.js
+++ b/packages/babel-plugin-jest-hoist/build/index.js
@@ -1,18 +1,22 @@
 'use strict';
 
+Object.defineProperty(exports, '__esModule', {
+  value: true
+});
+exports.default = void 0;
+
 /**
  * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  *
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
  *
- *
  */
-function invariant(condition, message) {
+const invariant = (condition, message) => {
   if (!condition) {
     throw new Error('babel-plugin-jest-hoist: ' + message);
   }
-} // We allow `jest`, `expect`, `require`, all default Node.js globals and all
+}; // We allow `jest`, `expect`, `require`, all default Node.js globals and all
 // ES2015 built-ins to be used inside of a `jest.mock` factory.
 // We also allow variables prefixed with `mock` as an escape-hatch.
 
@@ -78,7 +82,8 @@ const IDVisitor = {
     this.ids.add(path);
   },
 
-  blacklist: ['TypeAnnotation', 'TSTypeAnnotation', 'TSTypeReference']
+  blacklist: ['TypeAnnotation', 'TSTypeAnnotation', 'TSTypeReference'],
+  ids: new Set()
 };
 const FUNCTIONS = Object.create(null);
 
@@ -167,7 +172,7 @@ FUNCTIONS.deepUnmock = args => args.length === 1 && args[0].isStringLiteral();
 FUNCTIONS.disableAutomock = FUNCTIONS.enableAutomock = args =>
   args.length === 0;
 
-module.exports = () => {
+var _default = () => {
   const shouldHoistExpression = expr => {
     if (!expr.isCallExpression()) {
       return false;
@@ -195,3 +200,5 @@ module.exports = () => {
     }
   };
 };
+
+exports.default = _default;

Test plan

Green CI

Comment thread packages/babel-plugin-jest-hoist/src/index.ts Outdated
@SimenB SimenB added this to the TypeScript Migration milestone Feb 14, 2019
Copy link
Copy Markdown
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! left some inline questions 🙂

Comment thread packages/babel-plugin-jest-hoist/src/index.ts Outdated
Comment thread packages/babel-plugin-jest-hoist/src/index.ts Outdated
Comment thread packages/babel-plugin-jest-hoist/src/index.ts Outdated
@deneuv34
Copy link
Copy Markdown
Contributor Author

sure no problem

@SimenB SimenB merged commit c14a45d into jestjs:master Feb 16, 2019
@SimenB
Copy link
Copy Markdown
Member

SimenB commented Feb 16, 2019

Thanks @deneuv34!

@deneuv34
Copy link
Copy Markdown
Contributor Author

@SimenB BTW, thanks for the feedback! 😃

"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"@types/babel__traverse": "^7.0.6"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not install this type as a dev dependency?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's part of the public interface

@github-actions
Copy link
Copy Markdown

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants