Skip to content

How can I add the React Native Testing Library to test my package? #733

Closed Answered by yjose
yjose asked this question in Q&A
Discussion options

You must be logged in to vote

After a few hours of digging into the issue, it looks like using the React Native preset for testing fixed my problem.

Install @react-native/babel-preset

yarn add -D @react-native/babel-preset

Set @react-native/babel-preset as default preset for tests

// babel.config.js
module.exports = {
  presets: ['module:react-native-builder-bob/babel-preset'],
  env: {
    test: {
      presets: ['module:@react-native/babel-preset'],
    },
  },
};

@satya164 i noticed an issue while trying to run yarn run release:

ERROR The "angular" preset does not export a function. Maybe you are using an old version of the preset. Please upgrade.

The issue was related to commit lint, to fix it we need to update th…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@yjose
Comment options

@yjose
Comment options

Answer selected by satya164
@satya164
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants