1 | /**
|
2 | * Copyright (c) Facebook, Inc. and its affiliates.
|
3 | *
|
4 | * This source code is licensed under the MIT license found in the
|
5 | * LICENSE file in the root directory of this source tree.
|
6 | *
|
7 | * @format
|
8 | */
|
9 |
|
10 | ;
|
11 |
|
12 | /* eslint-env node */
|
13 |
|
14 | const path = require('path');
|
15 | const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
|
16 |
|
17 | module.exports = {
|
18 | // Mocks asset requires to return the filename. Makes it possible to test that
|
19 | // the correct images are loaded for components. Essentially
|
20 | // require('img1.png') becomes `Object { "testUri": 'path/to/img1.png' }` in
|
21 | // the Jest snapshot.
|
22 | process: (_, filename) =>
|
23 | `module.exports = {
|
24 | testUri:
|
25 | ${JSON.stringify(
|
26 | path.relative(__dirname, filename).replace(/\\/g, '/'),
|
27 | )}
|
28 | };`,
|
29 | getCacheKey: createCacheKeyFunction([__filename]),
|
30 | };
|