-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure Babel plugin to remove properties from production builds
`react-testing-library` provides a function to get elements by an test ID using the `data-testid` property (attribute) that can be added to any React component's JSX so it can be easily queried in tests. Note that this only be done when there is no other way which is documented in the guiding principles (1)! Since this property is ONLY relevant for test purposes, this commit configures the babel-plugin-react-remove-properties (2) to remove the property from production builds. The plugin is added in Gatsby's Babel configuration and loaded when in production mode. References: (1) https://github.com/kentcdodds/react-testing-library#guiding-principles (2) https://github.com/oliviertassinari/babel-plugin-react-remove-properties GH-39
- Loading branch information
1 parent
82f2db3
commit f944501
Showing
1 changed file
with
41 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters