@mui/x-codemod 7.20.0 → 7.23.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -227,9 +227,9 @@ npx @mui/x-codemod@latest v7.0.0/data-grid/remove-stabilized-experimentalFeature
227
227
 
228
228
  ### Tree View codemods
229
229
 
230
- #### `preset-safe` for tree view v7.0.0
230
+ #### `preset-safe` for Tree View v7.0.0
231
231
 
232
- The `preset-safe` codemods for tree view.
232
+ The `preset-safe` codemods for Tree View.
233
233
 
234
234
  ```bash
235
235
  npx @mui/x-codemod@latest v7.0.0/tree-view/preset-safe <path|folder>
@@ -247,7 +247,7 @@ The list includes these transformers
247
247
 
248
248
  #### `rename-tree-view-simple-tree-view`
249
249
 
250
- Renames the `TreeView` component to `SimpleTreeView`
250
+ Renames the Tree View component to Simple Tree View
251
251
 
252
252
  ```diff
253
253
  -import { TreeView } from '@mui/x-tree-view';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-codemod",
3
- "version": "7.20.0",
3
+ "version": "7.23.6",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",
@@ -25,7 +25,7 @@
25
25
  "url": "https://opencollective.com/mui-org"
26
26
  },
27
27
  "dependencies": {
28
- "@babel/core": "^7.25.7",
28
+ "@babel/core": "^7.25.8",
29
29
  "@babel/runtime": "^7.25.7",
30
30
  "@babel/traverse": "^7.25.7",
31
31
  "jscodeshift": "17.0.0",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/jscodeshift": "^0.12.0",
36
- "dayjs": "^1.11.11",
37
- "moment-timezone": "^0.5.45",
36
+ "dayjs": "^1.11.13",
37
+ "moment-timezone": "^0.5.46",
38
38
  "rimraf": "^6.0.1"
39
39
  },
40
40
  "sideEffects": false,
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renameImports = renameImports;
7
+ const getPathStrFromPath = path => {
8
+ let cleanPath;
9
+ if (path.get('type').value === 'ImportDeclaration') {
10
+ cleanPath = path;
11
+ } else {
12
+ cleanPath = path.parentPath.parentPath;
13
+ }
14
+ return cleanPath.node.source.value?.toString() ?? '';
15
+ };
16
+ const getRelativeEndpointFromPathStr = (pathStr, packageNames) => {
17
+ return pathStr.replace(new RegExp(`^(${packageNames.join('|')})/`), '');
18
+ };
19
+ const getMatchingNestedImport = (path, parameters) => {
20
+ const pathStr = getPathStrFromPath(path);
21
+ const relativeEndpoint = getRelativeEndpointFromPathStr(pathStr, parameters.packageNames);
22
+ return parameters.imports.find(importConfig => importConfig.oldEndpoint === relativeEndpoint);
23
+ };
24
+ const getMatchingRootImport = (path, parameters) => {
25
+ return parameters.imports.find(importConfig => {
26
+ return !importConfig.skipRoot && importConfig.importsMapping.hasOwnProperty(path.node.imported.name);
27
+ });
28
+ };
29
+ function renameImports(parameters) {
30
+ const {
31
+ j,
32
+ root
33
+ } = parameters;
34
+ const renamedIdentifiersMap = {};
35
+ const importDeclarations = root
36
+ // Find all the import declarations (import { ... } from '...')
37
+ .find(j.ImportDeclaration);
38
+
39
+ // Rename the nested imports specifiers
40
+ // - import { A } from '@mui/x-date-pickers/A'
41
+ // + import { B } from '@mui/x-date-pickers/A'
42
+ const nestedImportRegExp = new RegExp(`^(${parameters.packageNames.join('|')})/(.*)$`);
43
+ importDeclarations
44
+ // Filter out the declarations that are not nested endpoints of the matching packages or that don't have any update to apply
45
+ .filter(path => {
46
+ const pathStr = getPathStrFromPath(path);
47
+ if (!pathStr.match(nestedImportRegExp)) {
48
+ return false;
49
+ }
50
+ return !!getMatchingNestedImport(path, parameters);
51
+ })
52
+ // Find all the import specifiers (extract A in import { A } from '...')
53
+ .find(j.ImportSpecifier)
54
+ // Filter out the specifiers that don't need to be updated
55
+ .filter(path => {
56
+ return getMatchingNestedImport(path, parameters).importsMapping.hasOwnProperty(path.node.imported.name);
57
+ })
58
+ // Rename the import specifiers
59
+ .replaceWith(path => {
60
+ const newName = getMatchingNestedImport(path, parameters).importsMapping[path.node.imported.name];
61
+
62
+ // If the import is alias, we keep the alias and don't rename the variable usage
63
+ const hasAlias = path.node.local?.name !== path.node.imported.name;
64
+ if (hasAlias) {
65
+ return j.importSpecifier(j.identifier(newName), j.identifier(path.node.local.name));
66
+ }
67
+ renamedIdentifiersMap[path.node.imported.name] = newName;
68
+ return j.importSpecifier(j.identifier(newName));
69
+ });
70
+
71
+ // Rename the root imports specifiers
72
+ // - import { A } from '@mui/x-date-pickers'
73
+ // + import { B } from '@mui/x-date-pickers'
74
+ const rootImportRegExp = new RegExp(`^(${parameters.packageNames.join('|')})$`);
75
+ importDeclarations
76
+ // Filter out the declarations that are not root endpoint of the matching packages
77
+ .filter(path => {
78
+ const pathStr = getPathStrFromPath(path);
79
+ return !!pathStr.match(rootImportRegExp);
80
+ }).find(j.ImportSpecifier).filter(path => {
81
+ return !!getMatchingRootImport(path, parameters);
82
+ })
83
+ // Rename the import specifiers
84
+ .replaceWith(path => {
85
+ const newName = getMatchingRootImport(path, parameters).importsMapping[path.node.imported.name];
86
+
87
+ // If the import is alias, we keep the alias and don't rename the variable usage
88
+ const hasAlias = path.node.local?.name !== path.node.imported.name;
89
+ if (hasAlias) {
90
+ return j.importSpecifier(j.identifier(newName), j.identifier(path.node.local.name));
91
+ }
92
+ renamedIdentifiersMap[path.node.imported.name] = newName;
93
+ return j.importSpecifier(j.identifier(newName));
94
+ });
95
+
96
+ // Rename the nested import declarations
97
+ // - import { B } from '@mui/x-date-pickers/A'
98
+ // + import { B } from '@mui/x-date-pickers/B'
99
+ importDeclarations
100
+ // Filter out the declarations that are not nested endpoints of the matching packages or that don't have any update to apply
101
+ .filter(path => {
102
+ const pathStr = getPathStrFromPath(path);
103
+ if (!pathStr.match(nestedImportRegExp)) {
104
+ return false;
105
+ }
106
+ return !!getMatchingNestedImport(path, parameters)?.newEndpoint;
107
+ }).replaceWith(path => {
108
+ const pathStr = getPathStrFromPath(path);
109
+ const oldEndpoint = getRelativeEndpointFromPathStr(pathStr, parameters.packageNames);
110
+ const newEndpoint = getMatchingNestedImport(path, parameters).newEndpoint;
111
+ const newPathStr = pathStr.replace(oldEndpoint, newEndpoint);
112
+ return j.importDeclaration(
113
+ // Copy over the existing import specifiers
114
+ path.node.specifiers,
115
+ // Replace the source with our new source
116
+ j.stringLiteral(newPathStr));
117
+ });
118
+
119
+ // Rename the import usage
120
+ // - <A />
121
+ // + <B />
122
+ root.find(j.Identifier).filter(path => {
123
+ return renamedIdentifiersMap.hasOwnProperty(path.node.name);
124
+ }).replaceWith(path => {
125
+ const newName = renamedIdentifiersMap[path.node.name];
126
+ return j.identifier(newName);
127
+ });
128
+ return root;
129
+ }
@@ -4,51 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = transformer;
7
- const SUB_PACKAGES = {
8
- CalendarPicker: 'DateCalendar',
9
- CalendarPickerSkeleton: 'DayCalendarSkeleton',
10
- MonthPicker: 'MonthCalendar',
11
- YearPicker: 'YearCalendar',
12
- ClockPicker: 'TimeClock'
13
- };
14
- const VARIABLES = {
15
- // Date Calendar
16
- CalendarPicker: 'DateCalendar',
17
- CalendarPickerProps: 'DateCalendarProps',
18
- CalendarPickerSlotsComponent: 'DateCalendarSlotsComponent',
19
- CalendarPickerSlotsComponentsProps: 'DateCalendarSlotsComponentsProps',
20
- CalendarPickerClasses: 'DateCalendarClasses',
21
- CalendarPickerClassKey: 'DateCalendarClassKey',
22
- calendarPickerClasses: 'dateCalendarClasses',
23
- getCalendarPickerUtilityClass: 'getDateCalendarUtilityClass',
24
- // Month Calendar
25
- MonthPicker: 'MonthCalendar',
26
- MonthPickerProps: 'MonthCalendarProps',
27
- MonthPickerClasses: 'MonthCalendarClasses',
28
- MonthPickerClassKey: 'MonthCalendarClassKey',
29
- monthPickerClasses: 'monthCalendarClasses',
30
- getMonthPickerUtilityClass: 'getMonthCalendarUtilityClass',
31
- YearPicker: 'YearCalendar',
32
- YearPickerProps: 'YearCalendarProps',
33
- YearPickerClasses: 'YearCalendarClasses',
34
- YearPickerClassKey: 'YearCalendarClassKey',
35
- yearPickerClasses: 'yearCalendarClasses',
36
- getYearPickerUtilityClass: 'getYearCalendarUtilityClass',
37
- ClockPicker: 'TimeClock',
38
- ClockPickerProps: 'TimeClockProps',
39
- ClockPickerClasses: 'TimeClockClasses',
40
- ClockPickerClassKey: 'TimeClockClassKey',
41
- clockPickerClasses: 'timeClockClasses',
42
- getClockPickerUtilityClass: 'getTimeClockUtilityClass',
43
- CalendarPickerSkeleton: 'DayCalendarSkeleton',
44
- CalendarPickerSkeletonProps: 'DayCalendarSkeletonProps',
45
- CalendarPickerSkeletonClasses: 'DayCalendarSkeletonClasses',
46
- CalendarPickerSkeletonClassKey: 'DayCalendarSkeletonClassKey',
47
- calendarPickerSkeletonClasses: 'dayCalendarSkeletonClasses',
48
- getCalendarPickerSkeletonUtilityClass: 'getDayCalendarSkeletonUtilityClass'
49
- };
50
- const PACKAGE_REGEXP = /@mui\/x-date-pickers(-pro|)(\/(.*)|)/;
51
- const matchImport = path => (path.node.source.value?.toString() ?? '').match(PACKAGE_REGEXP);
7
+ var _renameImports = require("../../../util/renameImports");
52
8
  function transformer(file, api, options) {
53
9
  const j = api.jscodeshift;
54
10
  const root = j(file.source);
@@ -56,28 +12,68 @@ function transformer(file, api, options) {
56
12
  quote: 'single',
57
13
  trailingComma: true
58
14
  };
59
- const matchingImports = root.find(j.ImportDeclaration).filter(path => !!matchImport(path));
60
-
61
- // Rename the import specifiers
62
- // - import { MonthPicker } from '@mui/x-date-pickers/MonthPicker'
63
- // + import { MonthCalendar } from '@mui/x-date-pickers/MonthPicker'
64
- matchingImports.find(j.ImportSpecifier).filter(path => VARIABLES.hasOwnProperty(path.node.imported.name)).replaceWith(path => j.importSpecifier(j.identifier(VARIABLES[path.node.imported.name])));
65
-
66
- // Rename the nested import declarations
67
- // - import {} from '@mui/x-date-pickers/MonthPicker'
68
- // + import {} from '@mui/x-date-pickers/MonthCalendar'
69
- matchingImports.filter(path => SUB_PACKAGES.hasOwnProperty(matchImport(path)?.[3] ?? '')).replaceWith(path => {
70
- const subPackage = matchImport(path)[3];
71
- const importPath = path.node.source.value?.toString() ?? '';
72
- return j.importDeclaration(path.node.specifiers,
73
- // copy over the existing import specifiers
74
- j.stringLiteral(importPath.replace(subPackage, SUB_PACKAGES[subPackage])) // Replace the source with our new source
75
- );
15
+ (0, _renameImports.renameImports)({
16
+ j,
17
+ root,
18
+ packageNames: ['@mui/x-date-pickers', '@mui/x-date-pickers-pro'],
19
+ imports: [{
20
+ oldEndpoint: 'CalendarPicker',
21
+ newEndpoint: 'DateCalendar',
22
+ importsMapping: {
23
+ CalendarPicker: 'DateCalendar',
24
+ CalendarPickerProps: 'DateCalendarProps',
25
+ CalendarPickerSlotsComponent: 'DateCalendarSlotsComponent',
26
+ CalendarPickerSlotsComponentsProps: 'DateCalendarSlotsComponentsProps',
27
+ CalendarPickerClasses: 'DateCalendarClasses',
28
+ CalendarPickerClassKey: 'DateCalendarClassKey',
29
+ calendarPickerClasses: 'dateCalendarClasses',
30
+ getCalendarPickerUtilityClass: 'getDateCalendarUtilityClass'
31
+ }
32
+ }, {
33
+ oldEndpoint: 'MonthPicker',
34
+ newEndpoint: 'MonthCalendar',
35
+ importsMapping: {
36
+ MonthPicker: 'MonthCalendar',
37
+ MonthPickerProps: 'MonthCalendarProps',
38
+ MonthPickerClasses: 'MonthCalendarClasses',
39
+ MonthPickerClassKey: 'MonthCalendarClassKey',
40
+ monthPickerClasses: 'monthCalendarClasses',
41
+ getMonthPickerUtilityClass: 'getMonthCalendarUtilityClass'
42
+ }
43
+ }, {
44
+ oldEndpoint: 'YearPicker',
45
+ newEndpoint: 'YearCalendar',
46
+ importsMapping: {
47
+ YearPicker: 'YearCalendar',
48
+ YearPickerProps: 'YearCalendarProps',
49
+ YearPickerClasses: 'YearCalendarClasses',
50
+ YearPickerClassKey: 'YearCalendarClassKey',
51
+ yearPickerClasses: 'yearCalendarClasses',
52
+ getYearPickerUtilityClass: 'getYearCalendarUtilityClass'
53
+ }
54
+ }, {
55
+ oldEndpoint: 'ClockPicker',
56
+ newEndpoint: 'TimeClock',
57
+ importsMapping: {
58
+ ClockPicker: 'TimeClock',
59
+ ClockPickerProps: 'TimeClockProps',
60
+ ClockPickerClasses: 'TimeClockClasses',
61
+ ClockPickerClassKey: 'TimeClockClassKey',
62
+ clockPickerClasses: 'timeClockClasses',
63
+ getClockPickerUtilityClass: 'getTimeClockUtilityClass'
64
+ }
65
+ }, {
66
+ oldEndpoint: 'CalendarPickerSkeleton',
67
+ newEndpoint: 'DayCalendarSkeleton',
68
+ importsMapping: {
69
+ CalendarPickerSkeleton: 'DayCalendarSkeleton',
70
+ CalendarPickerSkeletonProps: 'DayCalendarSkeletonProps',
71
+ CalendarPickerSkeletonClasses: 'DayCalendarSkeletonClasses',
72
+ CalendarPickerSkeletonClassKey: 'DayCalendarSkeletonClassKey',
73
+ calendarPickerSkeletonClasses: 'dayCalendarSkeletonClasses',
74
+ getCalendarPickerSkeletonUtilityClass: 'getDayCalendarSkeletonUtilityClass'
75
+ }
76
+ }]
76
77
  });
77
-
78
- // Rename the import usage
79
- // - <CalendarPicker />
80
- // + <DateCalendar />
81
- root.find(j.Identifier).filter(path => VARIABLES.hasOwnProperty(path.node.name)).replaceWith(path => j.identifier(VARIABLES[path.node.name]));
82
78
  return root.toSource(printOptions);
83
79
  }
@@ -4,16 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = transformer;
7
- const VARIABLES = {
8
- TreeView: 'SimpleTreeView',
9
- TreeViewProps: 'SimpleTreeViewProps',
10
- TreeViewClasses: 'SimpleTreeViewClasses',
11
- TreeViewClassKey: 'SimpleTreeViewClassKey',
12
- treeViewClasses: 'simpleTreeViewClasses',
13
- getTreeViewUtilityClass: 'getSimpleTreeViewUtilityClass'
14
- };
15
- const PACKAGE_REGEXP = /@mui\/x-tree-view(\/(.*)|)/;
16
- const matchImport = path => (path.node.source.value?.toString() ?? '').match(PACKAGE_REGEXP);
7
+ var _renameImports = require("../../../util/renameImports");
17
8
  function transformer(file, api, options) {
18
9
  const j = api.jscodeshift;
19
10
  const root = j(file.source);
@@ -21,27 +12,22 @@ function transformer(file, api, options) {
21
12
  quote: 'single',
22
13
  trailingComma: true
23
14
  };
24
- const matchingImports = root.find(j.ImportDeclaration).filter(path => !!matchImport(path));
25
-
26
- // Rename the import specifiers
27
- // - import { TreeView } from '@mui/x-tree-view/TreeView'
28
- // + import { SimpleTreeView } from '@mui/x-tree-view/SimpleTreeView'
29
- matchingImports.find(j.ImportSpecifier).filter(path => VARIABLES.hasOwnProperty(path.node.imported.name)).replaceWith(path => j.importSpecifier(j.identifier(VARIABLES[path.node.imported.name])));
30
-
31
- // Rename the nested import declarations
32
- // - import {} from '@mui/x-tree-view/TreeView'
33
- // + import {} from '@mui/x-tree-view/SimpleTreeView'
34
- matchingImports.filter(path => matchImport(path)?.[2] === 'TreeView').replaceWith(path => {
35
- const importPath = path.node.source.value?.toString() ?? '';
36
- return j.importDeclaration(path.node.specifiers,
37
- // copy over the existing import specifiers
38
- j.stringLiteral(importPath.replace('TreeView', 'SimpleTreeView')) // Replace the source with our new source
39
- );
15
+ (0, _renameImports.renameImports)({
16
+ j,
17
+ root,
18
+ packageNames: ['@mui/x-tree-view'],
19
+ imports: [{
20
+ oldEndpoint: 'TreeView',
21
+ newEndpoint: 'SimpleTreeView',
22
+ importsMapping: {
23
+ TreeView: 'SimpleTreeView',
24
+ TreeViewProps: 'SimpleTreeViewProps',
25
+ TreeViewClasses: 'SimpleTreeViewClasses',
26
+ TreeViewClassKey: 'SimpleTreeViewClassKey',
27
+ treeViewClasses: 'simpleTreeViewClasses',
28
+ getTreeViewUtilityClass: 'getSimpleTreeViewUtilityClass'
29
+ }
30
+ }]
40
31
  });
41
-
42
- // Rename the import usage
43
- // - <TreeView />
44
- // + <SimpleTreeView />
45
- root.find(j.Identifier).filter(path => VARIABLES.hasOwnProperty(path.node.name)).replaceWith(path => j.identifier(VARIABLES[path.node.name]));
46
32
  return root.toSource(printOptions);
47
33
  }
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = transformer;
7
- const PACKAGE_REGEXP = /@mui\/x-tree-view(\/TreeItem|)/;
8
- const matchImport = path => (path.node.source.value?.toString() ?? '').match(PACKAGE_REGEXP);
7
+ var _renameImports = require("../../../util/renameImports");
9
8
  function transformer(file, api, options) {
10
9
  const j = api.jscodeshift;
11
10
  const root = j(file.source);
@@ -13,16 +12,16 @@ function transformer(file, api, options) {
13
12
  quote: 'single',
14
13
  trailingComma: true
15
14
  };
16
- const matchingImports = root.find(j.ImportDeclaration).filter(path => !!matchImport(path));
17
-
18
- // Rename the import specifiers
19
- // - import { useTreeItem } from '@mui/x-tree-view/TreeItem'
20
- // + import { useTreeItemState } from '@mui/x-tree-view/TreeItem'
21
- matchingImports.find(j.ImportSpecifier).filter(path => path.node.imported.name === 'useTreeItem').replaceWith(j.importSpecifier(j.identifier('useTreeItemState')));
22
-
23
- // Rename the import usage
24
- // - useTreeItem(nodeId);
25
- // + useTreeItemState(nodeId)
26
- root.find(j.Identifier).filter(path => path.node.name === 'useTreeItem').replaceWith(j.identifier('useTreeItemState'));
15
+ (0, _renameImports.renameImports)({
16
+ j,
17
+ root,
18
+ packageNames: ['@mui/x-tree-view'],
19
+ imports: [{
20
+ oldEndpoint: 'TreeItem',
21
+ importsMapping: {
22
+ useTreeItem: 'useTreeItemState'
23
+ }
24
+ }]
25
+ });
27
26
  return root.toSource(printOptions);
28
27
  }
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _path = _interopRequireDefault(require("path"));
5
- var _chai = require("chai");
6
- var _jscodeshift = _interopRequireDefault(require("jscodeshift"));
7
- var _ = _interopRequireDefault(require("."));
8
- var _readFile = _interopRequireDefault(require("../../../util/readFile"));
9
- function read(fileName) {
10
- return (0, _readFile.default)(_path.default.join(__dirname, fileName));
11
- }
12
- const TEST_FILES = ['nested-imports', 'root-imports'];
13
- describe('v7.0.0/tree-view', () => {
14
- describe('rename-tree-view-simple-tree-view', () => {
15
- TEST_FILES.forEach(testFile => {
16
- const actualPath = `./actual-${testFile}.spec.tsx`;
17
- const expectedPath = `./expected-${testFile}.spec.tsx`;
18
- describe(`${testFile.replace(/-/g, ' ')}`, () => {
19
- it('transforms imports as needed', () => {
20
- const actual = (0, _.default)({
21
- source: read(actualPath)
22
- }, {
23
- jscodeshift: _jscodeshift.default.withParser('tsx')
24
- }, {});
25
- const expected = read(expectedPath);
26
- (0, _chai.expect)(actual).to.equal(expected, 'The transformed version should be correct');
27
- });
28
- it('should be idempotent', () => {
29
- const actual = (0, _.default)({
30
- source: read(expectedPath)
31
- }, {
32
- jscodeshift: _jscodeshift.default.withParser('tsx')
33
- }, {});
34
- const expected = read(expectedPath);
35
- (0, _chai.expect)(actual).to.equal(expected, 'The transformed version should be correct');
36
- });
37
- });
38
- });
39
- });
40
- });
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _path = _interopRequireDefault(require("path"));
5
- var _chai = require("chai");
6
- var _jscodeshift = _interopRequireDefault(require("jscodeshift"));
7
- var _ = _interopRequireDefault(require("."));
8
- var _readFile = _interopRequireDefault(require("../../../util/readFile"));
9
- function read(fileName) {
10
- return (0, _readFile.default)(_path.default.join(__dirname, fileName));
11
- }
12
- const TEST_FILES = ['nested-imports', 'root-imports'];
13
- describe('v7.0.0/tree-view', () => {
14
- describe('rename-use-tree-item', () => {
15
- TEST_FILES.forEach(testFile => {
16
- const actualPath = `./actual-${testFile}.spec.tsx`;
17
- const expectedPath = `./expected-${testFile}.spec.tsx`;
18
- describe(`${testFile.replace(/-/g, ' ')}`, () => {
19
- it('transforms imports as needed', () => {
20
- const actual = (0, _.default)({
21
- source: read(actualPath)
22
- }, {
23
- jscodeshift: _jscodeshift.default.withParser('tsx')
24
- }, {});
25
- const expected = read(expectedPath);
26
- (0, _chai.expect)(actual).to.equal(expected, 'The transformed version should be correct');
27
- });
28
- it('should be idempotent', () => {
29
- const actual = (0, _.default)({
30
- source: read(expectedPath)
31
- }, {
32
- jscodeshift: _jscodeshift.default.withParser('tsx')
33
- }, {});
34
- const expected = read(expectedPath);
35
- (0, _chai.expect)(actual).to.equal(expected, 'The transformed version should be correct');
36
- });
37
- });
38
- });
39
- });
40
- });