- do
npm i
-
- run it using
npm run start
or justnode add-test-ids.js
- run using custom a directory
npm run start io-dir=../my/react-app
- assigning test-id's to all html tags
npm run start io-dir=../my/react-app --all
- overriding the default
data-test-id
attributenpm run start io-dir=../my/react-app --all customAttribute=test-id
- or you can copy-paste a
.jsx/.tsx
file to/input
folder, then donpm run start
- run it using
Of course, you can also change variables INPUT_FOLDER
, OUTPUT_FOLDER
to point to your input & output destination
(files can be overridden, so the input & output paths can be the same)
example file before: input/exampleApp.component.tsx
do
npm run start
example file after: output/exampleApp.component.tsx
Script has three lists of html elements/tags, described in this file:
- custom list of your joice
MY_TAGS
- picked by default - all HTML tags
HTML_TAGS
- picked when running with--all
flag - MUI library tags
MUI_TAGS
- added to the list when running with--mui
flag