react-native/packages/react-native-test-renderer/jest.config.js
Jack Pope c7479b07ae Add react-native-test-renderer package (#42644)
Summary:
The goal is to provide testing utilities that use Fabric and concurrent rendering by default to support the new RN architecture. Currently most testing is done through ReactTestRenderer, which is an overly-simplified rendering environment, non-concurrent by default, and over exposes internals. A dedicated RN environment in JS can allow for more realistic test execution.

This is the initial commit to create the `react-native-test-renderer` package. It currently only offers a simple toJSON() method on the root of a test, which is used for snapshot unit tests. We will be iterating here to add a query interface, event handling, and more.

## Changelog:
[GENERAL] [ADDED] - Added react-native-test-renderer package for Fabric rendered integration tests

Pull Request resolved: https://github.com/facebook/react-native/pull/42644

Test Plan:
```
$> cd packages/react-native-test-renderer
$> yarn jest
```

Output:

```
 PASS  src/renderer/__tests__/render-test.js
  render
    toJSON
      ✓ returns expected JSON output based on renderer component (7 ms)

Test Suites: 1 passed, 1 total
1 passed, 1 total
Snapshots:   1 passed, 1 total
Time:        2.869 s
```

Reviewed By: yungsters

Differential Revision: D53183101

Pulled By: jackpope

fbshipit-source-id: 8e29ba35f55f6c4eb2613ab106bc669d72f33d1d
2024-01-30 12:54:26 -08:00

26 lines
606 B
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
'use strict';
module.exports = {
haste: {
defaultPlatform: 'ios',
platforms: ['android', 'ios', 'native'],
},
transform: {
'^.+\\.(js|ts|tsx)$': 'babel-jest',
},
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)',
],
setupFilesAfterEnv: ['./src/jest/setup-files-after-env'],
testEnvironment: './src/jest/environment',
};