Answer the question
In order to leave comments, you need to log in
How to get around issues with arrow functions in store class for jest testing?
Hello. I'm setting up jest and there's a problem with arrow functions in stores.
It's in the jest documentation
Please note that if you use arrow functions in your classes, they will not be part of the mock. The reason for that is that arrow functions are not present on the object's prototype, they are merely properties holding a reference to a function.
module.exports = {
presets: [
[
"@babel/preset-env",
{
targets: {
node: "current"
}
}
],
"module:metro-react-native-babel-preset"
],
plugins: [
["@babel/plugin-transform-arrow-functions", { spec: true }],
[
"@babel/plugin-proposal-decorators",
{
legacy: true
}
]
]
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question