-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app-check, expo): add config plugin for iOS module initialization (
#7662) * Create config plugin for App Check * Update tests * Update packages/app-check/plugin/__tests__/README.md * add expo dep needed for plugin, update snapshots, auto-fix lint error --------- Co-authored-by: Mike Hardy <github@mikehardy.net>
- Loading branch information
Showing
16 changed files
with
1,189 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./plugin/build'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## Expo Config Plugin unit tests | ||
|
||
To test the changes to native code applied by config plugins, [snapshot tests](https://jestjs.io/docs/snapshot-testing) are used. Plugin test flow, in short: | ||
|
||
1. A test fixture is loaded. In this case, fixtures are template files (`build.gradle`, `AppDelegate.m` etc.) from [`expo-template-bare-minimum`](https://github.com/expo/expo/tree/main/templates/expo-template-bare-minimum). | ||
2. Plugin changes are applied (e.g. gradle dependency is added). | ||
3. Modified file is compared with previously saved snapshot. If they're equal, the test passes. If not, the test fails and the difference (actual vs expected) is shown. | ||
|
||
You can preview the snapshot files manually, by opening `__snapshots__/*.snap` files. | ||
|
||
### Updating the snapshots | ||
|
||
Snapshot tests are designed to ensure the plugin result will not change. In case you intentionally modified the plugin behavior (e.g. updated gradle dependency versions), you have to update the snapshots, otherwise the tests will fail. There are two ways to do it: | ||
|
||
- Update all snapshots by running `npm run tests:jest -u`. | ||
- Update snapshots interactively, one by one: | ||
1. Run `yarn tests:jest --watchAll` | ||
2. Press `i` to let `jest` display changes and prompt you for updating each snapshot. | ||
> This option is not available, when there are no failing snapshots |
Oops, something went wrong.