babel-plugin-react-test-id

1.0.2 • Public • Published

babel-plugin-react-test-id

This plugin removes testID props from your components. It's indented to be run for production/ development builds to prevent test-related data from being included in your bundle.

Example

In

<MyComponent testID="foo" disabled />

Out

<MyComponent disabled />

Installation

# yarn 
yarn add --dev babel-plugin-react-test-id
 
# npm 
npm install --save-dev babel-plugin-react-test-id

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["react-test-id"]
}

Via CLI

babel --plugins react-test-id script.js

Via Node API

require('babel-core').transform('code', {
  plugins: ['react-test-id'],
});

Options

This plugin accepts an options object with a single option: props, an array of strings representing the names of props you would like to remove (defaults to ['testID']).

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-react-test-id

Weekly Downloads

26,661

Version

1.0.2

License

MIT

Last publish

Collaborators

  • lemonmade