Skip to content

Commit

Permalink
πŸ’š Enable babel transpiling of react-native as well
Browse files Browse the repository at this point in the history
This fixes the code coverage github action.

Without this change, we were getting the error

```
i FAIL  www/__tests__/DateSelect.test.tsx
  ● Test suite failed to run

    SyntaxError: /private/tmp/e-mission-phone/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js: Unexpected token, expected "]" (39:5)
```

The last successful run was from Oct 17.
The first failed run was from Oct 23.

We have not made any changes to the react-native components that we directly
import since Sept 2024. However, we use a carat semver, so we will pull newly
released minor versions. One of our dependencies bumped up the version of RN
that they use, and released a new minor version, which broke this.

After fruitlessly searching around for a root cause (as documented in the PR
comments), since we import a lot of components and it was laborious to check
when each of them have been updated, I did a brute force search in GitHub for
this error and found both the same issue
facebook/react-native#48228
and a fix that worked
facebook/react-native#48228 (comment)

I am surprised this has not been reported widely, but I guess it is fairly new!
Thanks to @Basil-Code for the suggestion!
  • Loading branch information
shankari committed Dec 21, 2024
1 parent 3376a58 commit 4566cc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-typescript', '@babel/preset-react'],
presets: ['@babel/preset-env', '@babel/preset-typescript', '@babel/preset-react', 'module:@react-native/babel-preset'],
plugins: ['@babel/plugin-transform-flow-strip-types'],
}

0 comments on commit 4566cc0

Please sign in to comment.