Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug? #9926

Closed
birdofpreyru opened this issue Apr 29, 2020 · 4 comments · Fixed by #9955
Closed

A bug? #9926

birdofpreyru opened this issue Apr 29, 2020 · 4 comments · Fixed by #9955

Comments

@birdofpreyru
Copy link

birdofpreyru commented Apr 29, 2020

bb720d2#diff-ad0be0b5e1f4711c408a42bdbea512bcR43-R57

☝️ @SimenB This code change in your recent commit does break some tests in my code which used to work before. The issue I experience is that it is getting called from @jest/transform/build/ScriptTransformer.js:364:31 with null passed in as inputOptions argument, in this case the default {} value is not applied to inputOptions, it remains null and the code crashes at the line ...inputOptions.caller due to access to a field of null.

@SimenB
Copy link
Member

SimenB commented Apr 29, 2020

PR welcome changing to

diff --git i/packages/babel-jest/src/index.ts w/packages/babel-jest/src/index.ts
index 50259e0ec..5a23c4fdb 100644
--- i/packages/babel-jest/src/index.ts
+++ w/packages/babel-jest/src/index.ts
@@ -41,8 +41,9 @@ interface BabelJestTransformOptions extends TransformOptions {
 }
 
 const createTransformer = (
-  inputOptions: TransformOptions = {},
+  userOptions?: TransformOptions | null,
 ): BabelJestTransformer => {
+  const inputOptions: TransformOptions = userOptions ?? {};
   const options: BabelJestTransformOptions = {
     ...inputOptions,
     caller: {

along with some tests 🙂

@yinm
Copy link
Contributor

yinm commented Apr 30, 2020

Can I take this issue?

@SimenB
Copy link
Member

SimenB commented Apr 30, 2020

Go for it @yinm!

@github-actions
Copy link

This issue 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 a pull request may close this issue.

3 participants