Enabled transform-class-properties
plugin webpack module exports, which is helping me to have class
which is a registered word in javascript to be used normally in my html code and transpilation step using the plugin takes on the heavy lifting.
I'm using enzyme
for testing components now I have issue where in I have my component like this.
export default class Settings extends React.Component {
render() {
return (
<div class='something'>Settings</div>
);
}
}
If I want to test in my unit test if I have any something
class in my Component it fails always.
export default class Settings extends React.Component {
render() {
return (
<div className='something'>Settings</div>
);
}
}
But if I do the above transformation myself, I have UT passing.
How can I do the transformation step to kick in before unit testing too. I'm using npm script test like this "test": "mocha -w ./test/**/*.js --compilers js:babel-core/register --reporter spec",
我的坏-解决方案在于.bablerc
使用另一个stackoverflow线程解决了该问题Mocha为ES6对象散布运算符抛出了意外的令牌错误
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.