1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true
|
5 | });
|
6 | exports.default = relativePath;
|
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(nodeInterop) {
|
19 | if (typeof WeakMap !== 'function') return null;
|
20 | var cacheBabelInterop = new WeakMap();
|
21 | var cacheNodeInterop = new WeakMap();
|
22 | return (_getRequireWildcardCache = function (nodeInterop) {
|
23 | return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
24 | })(nodeInterop);
|
25 | }
|
26 |
|
27 | function _interopRequireWildcard(obj, nodeInterop) {
|
28 | if (!nodeInterop && 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(nodeInterop);
|
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 (key !== 'default' && 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 | function relativePath(config, testPath) {
|
67 |
|
68 |
|
69 |
|
70 | testPath = path().relative(config.cwd || config.rootDir, testPath);
|
71 | const dirname = path().dirname(testPath);
|
72 | const basename = path().basename(testPath);
|
73 | return {
|
74 | basename,
|
75 | dirname
|
76 | };
|
77 | }
|