diff --git a/examples/basic/.eslintignore b/examples/basic/.eslintignore new file mode 100644 index 00000000..bda2aca8 --- /dev/null +++ b/examples/basic/.eslintignore @@ -0,0 +1 @@ +jest-setup.ts diff --git a/examples/basic/components/AnimatedView.tsx b/examples/basic/components/AnimatedView.tsx index d2f2a2e1..7f42d008 100644 --- a/examples/basic/components/AnimatedView.tsx +++ b/examples/basic/components/AnimatedView.tsx @@ -17,7 +17,7 @@ export function AnimatedView(props: AnimatedViewProps) { duration: props.fadeInDuration ?? 250, useNativeDriver: props.useNativeDriver ?? true, }).start(); - }, [fadeAnim]); + }, [fadeAnim, props.fadeInDuration, props.useNativeDriver]); return ( { it('should use native driver when useNativeDriver is true', async () => { render( - Test + Test , ); expect(screen.root).toHaveStyle({ opacity: 0 }); @@ -25,7 +27,7 @@ describe('AnimatedView', () => { it('should not use native driver when useNativeDriver is false', async () => { render( - Test + Test , ); expect(screen.root).toHaveStyle({ opacity: 0 }); diff --git a/examples/basic/jest-setup.ts b/examples/basic/jest-setup.ts index 7f63025d..29505bd5 100644 --- a/examples/basic/jest-setup.ts +++ b/examples/basic/jest-setup.ts @@ -1,7 +1,9 @@ -/* eslint-disable no-undef, import/no-extraneous-dependencies */ +import { configure } from '@testing-library/react-native'; // Import built-in Jest matchers import '@testing-library/react-native/extend-expect'; // Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper'); + +configure({ concurrentRoot: true }); diff --git a/examples/basic/package.json b/examples/basic/package.json index 86dd9d99..eb0ea444 100644 --- a/examples/basic/package.json +++ b/examples/basic/package.json @@ -20,7 +20,7 @@ }, "devDependencies": { "@babel/core": "^7.24.0", - "@testing-library/react-native": "^12.7.1", + "@testing-library/react-native": "^12.8.0", "@types/eslint": "^8.56.10", "@types/jest": "^29.5.12", "@types/react": "~18.2.79", diff --git a/examples/basic/yarn.lock b/examples/basic/yarn.lock index 69368e8e..518d371a 100644 --- a/examples/basic/yarn.lock +++ b/examples/basic/yarn.lock @@ -2463,9 +2463,9 @@ __metadata: languageName: node linkType: hard -"@testing-library/react-native@npm:^12.7.1": - version: 12.7.1 - resolution: "@testing-library/react-native@npm:12.7.1" +"@testing-library/react-native@npm:^12.8.0": + version: 12.8.0 + resolution: "@testing-library/react-native@npm:12.8.0" dependencies: jest-matcher-utils: "npm:^29.7.0" pretty-format: "npm:^29.7.0" @@ -2478,7 +2478,7 @@ __metadata: peerDependenciesMeta: jest: optional: true - checksum: 10c0/caaa4bdf97834b307b72af05c447ce40a2ba2ff40b464050bc29535caadf81981ea2873668445e633fdb3d13efccb136ef0932d6d9f4736bc6f7f98be98088d4 + checksum: 10c0/216d40eefc3afa3259b37611213dcd6667cd0b8deb30521a8aaabe3afc15f07116ce64acba150f8c88b8e268df80639baf6bc38f05af1dbbae247e1d07639bde languageName: node linkType: hard @@ -8923,7 +8923,7 @@ __metadata: resolution: "root-workspace-0b6124@workspace:." dependencies: "@babel/core": "npm:^7.24.0" - "@testing-library/react-native": "npm:^12.7.1" + "@testing-library/react-native": "npm:^12.8.0" "@types/eslint": "npm:^8.56.10" "@types/jest": "npm:^29.5.12" "@types/react": "npm:~18.2.79" diff --git a/examples/cookbook/.eslintignore b/examples/cookbook/.eslintignore index 2b876e21..91e57fb4 100644 --- a/examples/cookbook/.eslintignore +++ b/examples/cookbook/.eslintignore @@ -1 +1,2 @@ -test-utils.* \ No newline at end of file +jest-setup.ts +test-utils.* diff --git a/examples/cookbook/jest-setup.ts b/examples/cookbook/jest-setup.ts index d5160525..c6631730 100644 --- a/examples/cookbook/jest-setup.ts +++ b/examples/cookbook/jest-setup.ts @@ -1,4 +1,4 @@ -/* eslint-disable no-undef, import/no-extraneous-dependencies */ +import { configure } from '@testing-library/react-native'; // Import built-in Jest matchers import '@testing-library/react-native/extend-expect'; @@ -9,7 +9,11 @@ jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper'); // Enable API mocking via Mock Service Worker (MSW) beforeAll(() => server.listen()); + // Reset any runtime request handlers we may add during the tests afterEach(() => server.resetHandlers()); + // Disable API mocking after the tests are done afterAll(() => server.close()); + +configure({ concurrentRoot: true }); diff --git a/examples/cookbook/package.json b/examples/cookbook/package.json index 8c2416cb..3bb98797 100644 --- a/examples/cookbook/package.json +++ b/examples/cookbook/package.json @@ -30,7 +30,7 @@ "devDependencies": { "@babel/core": "^7.20.0", "@expo/metro-runtime": "~3.2.3", - "@testing-library/react-native": "^12.7.2", + "@testing-library/react-native": "^12.8.0", "@types/eslint": "^8.56.10", "@types/jest": "^29.5.12", "@types/react": "~18.2.45", diff --git a/examples/cookbook/yarn.lock b/examples/cookbook/yarn.lock index acf5f538..01a301ae 100644 --- a/examples/cookbook/yarn.lock +++ b/examples/cookbook/yarn.lock @@ -2833,9 +2833,9 @@ __metadata: languageName: node linkType: hard -"@testing-library/react-native@npm:^12.7.2": - version: 12.7.2 - resolution: "@testing-library/react-native@npm:12.7.2" +"@testing-library/react-native@npm:^12.8.0": + version: 12.8.0 + resolution: "@testing-library/react-native@npm:12.8.0" dependencies: jest-matcher-utils: "npm:^29.7.0" pretty-format: "npm:^29.7.0" @@ -2848,7 +2848,7 @@ __metadata: peerDependenciesMeta: jest: optional: true - checksum: 10c0/0e4e26bd211056646f8b5c80e9177efc90affe0ddc7e1a2c22742a4e6da7129ec1f9125c7d233adddeb27f429fb3eb91e3f3bfa9e77e176f042475574546b001 + checksum: 10c0/216d40eefc3afa3259b37611213dcd6667cd0b8deb30521a8aaabe3afc15f07116ce64acba150f8c88b8e268df80639baf6bc38f05af1dbbae247e1d07639bde languageName: node linkType: hard @@ -9762,7 +9762,7 @@ __metadata: dependencies: "@babel/core": "npm:^7.20.0" "@expo/metro-runtime": "npm:~3.2.3" - "@testing-library/react-native": "npm:^12.7.2" + "@testing-library/react-native": "npm:^12.8.0" "@types/eslint": "npm:^8.56.10" "@types/jest": "npm:^29.5.12" "@types/react": "npm:~18.2.45"