Skip to content

Commit 9af3c96

Browse files
UNIDY2002facebook-github-bot
authored andcommitted
switch from @types/jest to @jest/globals (#36068)
Summary: Originally proposed in react-native-community/discussions-and-proposals#592 Main changes are: - Explicitly importing the global APIs in `App.test.tsx` - Drop `types/jest` from the devDependency list Benefits of these changes will be: - Keep in line with Jest's recommended practice - Remove a dev-dependency to make dependencies slimmer References: - jestjs/jest#13133 - DefinitelyTyped/DefinitelyTyped#62037 ## Changelog [GENERAL] [CHANGED] - Switch from `types/jest` to `jest/globals` for new react-native projects Pull Request resolved: #36068 Test Plan: 1. Create a new RN project from the modified template 2. Ensure yarn test passes 3. Ensure IDEs do not complain about `App.test.tsx` Reviewed By: cipolleschi Differential Revision: D43080151 Pulled By: cortinico fbshipit-source-id: c9161cb930c78f3a1eaa08ccb6483aa38d52fa3c
1 parent 7adf6b1 commit 9af3c96

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

template/__tests__/App.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import 'react-native';
66
import React from 'react';
77
import App from '../App';
88

9+
// Note: import explicitly to use the types shiped with jest.
10+
import {it} from '@jest/globals';
11+
912
// Note: test renderer must be required after react-native.
1013
import renderer from 'react-test-renderer';
1114

template/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"@babel/runtime": "^7.12.5",
2020
"@react-native/eslint-config": "^0.72.1",
2121
"@tsconfig/react-native": "^2.0.2",
22-
"@types/jest": "^29.2.1",
2322
"@types/react": "^18.0.24",
2423
"@types/react-test-renderer": "^18.0.0",
2524
"babel-jest": "^29.2.1",

0 commit comments

Comments
 (0)