1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | function path() {
|
9 | const data = _interopRequireWildcard(require('path'));
|
10 |
|
11 | path = function () {
|
12 | return data;
|
13 | };
|
14 |
|
15 | return data;
|
16 | }
|
17 |
|
18 | function _getRequireWildcardCache() {
|
19 | if (typeof WeakMap !== 'function') return null;
|
20 | var cache = new WeakMap();
|
21 | _getRequireWildcardCache = function () {
|
22 | return cache;
|
23 | };
|
24 | return cache;
|
25 | }
|
26 |
|
27 | function _interopRequireWildcard(obj) {
|
28 | if (obj && obj.__esModule) {
|
29 | return obj;
|
30 | }
|
31 | if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
32 | return {default: obj};
|
33 | }
|
34 | var cache = _getRequireWildcardCache();
|
35 | if (cache && cache.has(obj)) {
|
36 | return cache.get(obj);
|
37 | }
|
38 | var newObj = {};
|
39 | var hasPropertyDescriptor =
|
40 | Object.defineProperty && Object.getOwnPropertyDescriptor;
|
41 | for (var key in obj) {
|
42 | if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
43 | var desc = hasPropertyDescriptor
|
44 | ? Object.getOwnPropertyDescriptor(obj, key)
|
45 | : null;
|
46 | if (desc && (desc.get || desc.set)) {
|
47 | Object.defineProperty(newObj, key, desc);
|
48 | } else {
|
49 | newObj[key] = obj[key];
|
50 | }
|
51 | }
|
52 | }
|
53 | newObj.default = obj;
|
54 | if (cache) {
|
55 | cache.set(obj, newObj);
|
56 | }
|
57 | return newObj;
|
58 | }
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | const MOCKS_PATTERN = path().sep + '__mocks__' + path().sep;
|
67 |
|
68 | const getMockName = filePath => {
|
69 | const mockPath = filePath.split(MOCKS_PATTERN)[1];
|
70 | return mockPath
|
71 | .substring(0, mockPath.lastIndexOf(path().extname(mockPath)))
|
72 | .replace(/\\/g, '/');
|
73 | };
|
74 |
|
75 | var _default = getMockName;
|
76 | exports.default = _default;
|