Skip to content

Commit

Permalink
Move jest config from package.json to dedicated jest.config.js file (#…
Browse files Browse the repository at this point in the history
…35856)

Summary:
According to: https://jestjs.io/docs/configuration

> It is recommended to define the configuration in a dedicated JavaScript, TypeScript or JSON file. The file will be discovered automatically, if it is named jest.config.js|ts|mjs|cjs|json.

react-native projects have the jest config in package.json, this change aims to follow jest recommendations and have a dedicated file for jest configs.

Originally suggested here: react-native-community/discussions-and-proposals#583

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL] [CHANGED] - Moved jest config from package.json to dedicated jest.config.js file

Pull Request resolved: #35856

Test Plan:
1. cd template
2. yarn
3. yarn test

The test should (still) pass

Reviewed By: christophpurrer

Differential Revision: D42544351

Pulled By: robhogan

fbshipit-source-id: e27d1dad2b52d757777c40a77d0639f381557c88
  • Loading branch information
Adnan-Bacic authored and facebook-github-bot committed Jan 18, 2023
1 parent f4072b1 commit 473eb1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions template/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
preset: 'react-native',
};
3 changes: 0 additions & 3 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,5 @@
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
},
"jest": {
"preset": "react-native"
}
}

0 comments on commit 473eb1d

Please sign in to comment.