mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Adds `flow` (or `noflow`) to all files in this directory and ensures that Flow succeeds (by adding type annotations, using minor refactors, or suppressing errors due to intentionally dynamic logic). This will help improve type safety when making changes both in these files as well as files that these depend on. Changelog: [Internal] Pull Request resolved: https://github.com/facebook/react-native/pull/51652 Test Plan: Ran Flow and Jest tests successfully: ``` $ yarn flow $ yarn test ``` Ran a Jest unit test internally to make sure they work with our internal environment setup: ``` $ cd ~/fbsource $ js1 test /View-test.js ``` Reviewed By: javache Differential Revision: D75488160 Pulled By: yungsters fbshipit-source-id: 536cef9699acfa1edcd3dcf61c53ebcd92f560f9
34 lines
887 B
JavaScript
34 lines
887 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.
|
|
*
|
|
* @noflow
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
/* eslint-env node */
|
|
|
|
const createCacheKeyFunction =
|
|
require('@jest/create-cache-key-function').default;
|
|
const path = require('path');
|
|
|
|
module.exports = {
|
|
// Mocks asset requires to return the filename. Makes it possible to test that
|
|
// the correct images are loaded for components. Essentially
|
|
// require('img1.png') becomes `Object { "testUri": 'path/to/img1.png' }` in
|
|
// the Jest snapshot.
|
|
process: (_, filename) => ({
|
|
code: `module.exports = {
|
|
testUri:
|
|
${JSON.stringify(
|
|
path.relative(__dirname, filename).replace(/\\/g, '/'),
|
|
)}
|
|
};`,
|
|
}),
|
|
getCacheKey: createCacheKeyFunction([__filename]),
|
|
};
|