在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:akameco/babel-plugin-react-data-testid开源软件地址:https://github.com/akameco/babel-plugin-react-data-testid开源编程语言:TypeScript 92.5%开源软件介绍:babel-plugin-react-data-testid
Install
Usage.babelrc.json {
"plugins": ["react-data-testid"]
} Before: function Div() {
return <div />
}
const Hello = () => <div>hello</div> After: function Div() {
return <div data-testid="Div" />
}
const Hello = () => <div data-testid="Hello">hello</div> Note: Does not support class components. OptionsattributesBy default attributes with name .babelrc.json {
"plugins": [["react-data-testid", { "attributes": ["data-cy"] }]]
} function Div() {
return <div />
}
const Hello = () => <div>hello</div> After: function Div() {
return <div data-cy="Div" />
}
const Hello = () => <div data-cy="Hello">hello</div> If you need to add multiple attributes, you can define an attributes array as follows: {
"plugins": [
["react-data-testid", { "attributes": ["data-testid", "data-cy"] }]
]
}
Contributors |
akameco |
2022-08-15
2022-08-17
2023-10-27
2022-09-23
2022-08-18
请发表评论