Custom jest transformer to remove flow type annotations using buble
# yarn add buble-jest-flow
npm install --save-dev buble-jest-flow # npm i -D buble-jest-flow
process(src, options);
// package.json
{
"jest": {
"transform": {
"^.+\\.jsx?$": "buble-jest-flow"
}
}
}
OR
// jest.config.js
module.exports = {
transform: {
'^.+\\.jsx?$': 'buble-jest-flow',
},
};