- do
npm i -
- run it using
npm run startor 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-idattributenpm run start io-dir=../my/react-app --all customAttribute=test-id - or you can copy-paste a
.jsx/.tsxfile to/inputfolder, 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 startexample 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--allflag - MUI library tags
MUI_TAGS- added to the list when running with--muiflag