1.1.0 • Published 1 year ago

babel-plugin-jsx-auto-test-id v1.1.0

Weekly downloads
133
License
MIT
Repository
github
Last release
1 year ago

babel-plugin-jsx-auto-test-id · package version tests

Automatically adds data-test id's to every component host element. Useful to E2E tests.

Usage

Via .babelrc:

{
  "plugins": ["jsx-auto-test-id"]
}

If you want to set a custom attribute name:

{
  "plugins": ["jsx-auto-test-id", { "attributeName": "data-my-custom-test-id" }]
}

Example

Input (React)

function App() {
  return (
    <div>
      <p>foo</p>
      <p>bar</p>
    </div>
  )
}

Output

<div data-test="App">
  <p>foo</p>
  <p>bar</p>
</div>
1.1.0

1 year ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago