ember-codemod-rename-test-modules 2.1.4 → 2.2.1
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.
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
2
|
+
import { join, relative, sep } from 'node:path';
|
|
3
3
|
import { updateJavaScript } from '@codemod-utils/ast-template-tag';
|
|
4
4
|
import { findFiles, parseFilePath } from '@codemod-utils/files';
|
|
5
5
|
import { isTypeScript, parseEntity, renameModule, } from '../../utils/rename-tests/index.js';
|
|
6
6
|
const folderToEntityType = new Map();
|
|
7
7
|
function getModuleName(filePath) {
|
|
8
8
|
let { dir, name } = parseFilePath(filePath);
|
|
9
|
-
dir =
|
|
9
|
+
dir = relative('tests/acceptance', dir);
|
|
10
10
|
name = name.replace(/-test$/, '');
|
|
11
11
|
const { entityType, remainingPath } = parseEntity(dir, folderToEntityType);
|
|
12
|
-
const entityName = join(remainingPath, name);
|
|
12
|
+
const entityName = join(remainingPath, name).replaceAll(sep, '/');
|
|
13
13
|
// a.k.a. friendlyTestDescription
|
|
14
14
|
return ['Acceptance', entityType, entityName].filter(Boolean).join(' | ');
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
2
|
+
import { join, relative, sep } from 'node:path';
|
|
3
3
|
import { updateJavaScript } from '@codemod-utils/ast-template-tag';
|
|
4
4
|
import { findFiles, parseFilePath } from '@codemod-utils/files';
|
|
5
5
|
import { isTypeScript, parseEntity, renameModule, } from '../../utils/rename-tests/index.js';
|
|
@@ -10,10 +10,10 @@ const folderToEntityType = new Map([
|
|
|
10
10
|
]);
|
|
11
11
|
function getModuleName(filePath) {
|
|
12
12
|
let { dir, name } = parseFilePath(filePath);
|
|
13
|
-
dir =
|
|
13
|
+
dir = relative('tests/integration', dir);
|
|
14
14
|
name = name.replace(/-test$/, '');
|
|
15
15
|
const { entityType, remainingPath } = parseEntity(dir, folderToEntityType);
|
|
16
|
-
const entityName = join(remainingPath, name);
|
|
16
|
+
const entityName = join(remainingPath, name).replaceAll(sep, '/');
|
|
17
17
|
// a.k.a. friendlyTestDescription
|
|
18
18
|
return ['Integration', entityType, entityName].filter(Boolean).join(' | ');
|
|
19
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
2
|
+
import { join, relative, sep } from 'node:path';
|
|
3
3
|
import { updateJavaScript } from '@codemod-utils/ast-template-tag';
|
|
4
4
|
import { findFiles, parseFilePath } from '@codemod-utils/files';
|
|
5
5
|
import { isTypeScript, parseEntity, renameModule, } from '../../utils/rename-tests/index.js';
|
|
@@ -17,10 +17,10 @@ const folderToEntityType = new Map([
|
|
|
17
17
|
]);
|
|
18
18
|
function getModuleName(filePath) {
|
|
19
19
|
let { dir, name } = parseFilePath(filePath);
|
|
20
|
-
dir =
|
|
20
|
+
dir = relative('tests/unit', dir);
|
|
21
21
|
name = name.replace(/-test$/, '');
|
|
22
22
|
const { entityType, remainingPath } = parseEntity(dir, folderToEntityType);
|
|
23
|
-
const entityName = join(remainingPath, name);
|
|
23
|
+
const entityName = join(remainingPath, name).replaceAll(sep, '/');
|
|
24
24
|
// a.k.a. friendlyTestDescription
|
|
25
25
|
return ['Unit', entityType, entityName].filter(Boolean).join(' | ');
|
|
26
26
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { sep } from 'node:path';
|
|
1
2
|
export function parseEntity(dir, folderToEntityType) {
|
|
2
|
-
const [folder, ...remainingPaths] = dir.split(
|
|
3
|
+
const [folder, ...remainingPaths] = dir.split(sep);
|
|
3
4
|
const entityType = folderToEntityType.get(folder);
|
|
4
5
|
if (entityType === undefined) {
|
|
5
6
|
return {
|
|
@@ -9,6 +10,6 @@ export function parseEntity(dir, folderToEntityType) {
|
|
|
9
10
|
}
|
|
10
11
|
return {
|
|
11
12
|
entityType,
|
|
12
|
-
remainingPath: remainingPaths.join(
|
|
13
|
+
remainingPath: remainingPaths.join(sep),
|
|
13
14
|
};
|
|
14
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-codemod-rename-test-modules",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Codemod to rename test modules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemod",
|
|
@@ -23,32 +23,32 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@codemod-utils/ast-javascript": "^2.0
|
|
27
|
-
"@codemod-utils/ast-template-tag": "^1.0
|
|
28
|
-
"@codemod-utils/files": "^3.
|
|
26
|
+
"@codemod-utils/ast-javascript": "^2.1.0",
|
|
27
|
+
"@codemod-utils/ast-template-tag": "^1.1.0",
|
|
28
|
+
"@codemod-utils/files": "^3.2.1",
|
|
29
29
|
"yargs": "^18.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@changesets/cli": "^2.29.
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@ijlee2-frontend-configs/eslint-config-node": "^2.
|
|
36
|
-
"@ijlee2-frontend-configs/prettier": "^2.
|
|
32
|
+
"@changesets/cli": "^2.29.8",
|
|
33
|
+
"@codemod-utils/tests": "^2.2.0",
|
|
34
|
+
"@ijlee2-frontend-configs/changesets": "^1.0.0",
|
|
35
|
+
"@ijlee2-frontend-configs/eslint-config-node": "^2.3.1",
|
|
36
|
+
"@ijlee2-frontend-configs/prettier": "^2.3.1",
|
|
37
37
|
"@sondr3/minitest": "^0.1.2",
|
|
38
38
|
"@tsconfig/node20": "^20.1.8",
|
|
39
39
|
"@tsconfig/strictest": "^2.0.8",
|
|
40
|
-
"@types/node": "^20.19.
|
|
40
|
+
"@types/node": "^20.19.26",
|
|
41
41
|
"@types/yargs": "^17.0.35",
|
|
42
42
|
"concurrently": "^9.2.1",
|
|
43
43
|
"eslint": "^9.39.1",
|
|
44
|
-
"prettier": "^3.
|
|
44
|
+
"prettier": "^3.7.4",
|
|
45
45
|
"typescript": "^5.9.3"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": "20.* || >= 22"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
|
-
"build": "
|
|
51
|
+
"build": "sh build.sh --production",
|
|
52
52
|
"format": "prettier . --cache --write",
|
|
53
53
|
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
|
|
54
54
|
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\" && pnpm format",
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
"lint:types": "tsc --noEmit",
|
|
59
59
|
"release:prepare": "changeset version",
|
|
60
60
|
"release:publish": "pnpm build && changeset publish",
|
|
61
|
-
"test": "
|
|
61
|
+
"test": "sh build.sh --test && mt dist-for-testing --quiet"
|
|
62
62
|
}
|
|
63
63
|
}
|