GitXplorerGitXplorer
k

babel-plugin-remove-test-ids

public
41 stars
3 forks
0 issues

Commits

List of commits on branch master.
Unverified
27f2e69617dafea929e73395963d6810346bb3d6

Remove useless badges! 🗑️

kkutyel committed 2 years ago
Unverified
fb73db9fff7c572729d08368ea731217b9f6c8dd

Add funding! 💝

kkutyel committed 2 years ago
Verified
5c346a083f1003d8e9168dbed58b253066bdba09

Fix npm version badge 🎫

kkutyel committed 6 years ago
Verified
514404d3d6a4c42ea6fcf12ba9ebe1ad8a9a5e86

Delete package-lock.json

committed 7 years ago
Unverified
8c1544eec6572d900671c5f12449cbffe700f8a1

Rename test file

kkutyel committed 7 years ago
Verified
51a86b8e6b59ee79ff7ca94c5b3b803b3fc8c33e

Fix video 😳

kkutyel committed 7 years ago

README

The README file for this repository.

babel-plugin-remove-test-ids

Standard - JavaScript Style Guide

NPM version Build Status Coverage Status NPM Status Donate

Babel plugin to remove data-test-id attributes from the JSX

Install

$ npm install babel-plugin-remove-test-ids --save

Usage

.babelrc

{
  "plugins": ["remove-test-ids"]
}

... you can also configure it with your attributes!

{
  "plugins": [
    [
      "remove-test-ids",
      {
        "attributes": ["data-test", "data-custom-test-attr"]
      }
    ]
  ]
}

Motivation

In React Alicante 2017, Forbes Lindsay gave a talk about "End to End testing React applications" with cabbie and explained the pattern of adding data-test-id props to your components as a good practice for improving testability.

video

He also mentioned that it would be "fairly easy to do a Babel plugin" to strip those attributes from the actual DOM, if you care enough. :)

Also, other testing tools like Selenium uses a similar approach and could benefit from this plugin as well!

License

MIT © Flavio Corpa.