Skip to content

Commit

Permalink
build(native): fixes test issues on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael-rollo committed Aug 2, 2023
1 parent 829c0e1 commit 2dcf21c
Show file tree
Hide file tree
Showing 4 changed files with 556 additions and 510 deletions.
12 changes: 12 additions & 0 deletions jest/setup/native.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import '@testing-library/jest-native/extend-expect';

const frameTime = 10;

/**
* This fix came to help with the RN's jest setup requestAnimationFrame issue that
* was affecting native's components tests that relate with animations.
* At the link below we can find more detailed description.
* * https://stackoverflow.com/questions/42268673/jest-test-animated-view-for-react-native-app/51067606#51067606
*/
global.requestAnimationFrame = cb => {
setTimeout(cb, frameTime);
};

/**
* This fix was originally proposed by the package react-16-node-hanging-test-fix
* (https://npmjs.com/package/react-16-node-hanging-test-fix). Actually, the problem
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@babel/preset-env": "^7.8.4",
"@babel/preset-react": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@react-native-community/eslint-config": "^3.0.1",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/jest-native": "^4.0.2",
"@testing-library/react": "^13.4.0",
Expand All @@ -60,8 +59,8 @@
"fs-extra": "^8.1.0",
"git-last-commit": "^1.0.0",
"husky": "3.0.5",
"jest": "^29.2.1",
"jest-environment-jsdom": "^29.2.1",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"jest-styled-components": "^6.3.3",
"lerna": "^5.0.0",
"lint-staged": "9.2.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/yoga/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@
"devDependencies": {
"@react-native-community/eslint-config": "^3.0.1",
"babel-plugin-inline-react-svg": "^1.1.1",
"react-native": "0.72.0",
"react-native": "0.72.3",
"styled-components": "^4.4.0"
},
"peerDependencies": {
"@react-native-picker/picker": "^2.4.9",
"react": ">=16",
"react-native": "0.72.0",
"react-native": "0.72.3",
"styled-components": "^4.4.0"
}
}
Loading

0 comments on commit 2dcf21c

Please sign in to comment.