@pagopa/dx-cli 0.18.9 → 0.18.11
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.
|
@@ -19,14 +19,14 @@ describe("LocalCodemodRegistry", () => {
|
|
|
19
19
|
registry.add(a);
|
|
20
20
|
registry.add(b);
|
|
21
21
|
const result = await registry.getAll();
|
|
22
|
+
expect.assertions(3);
|
|
22
23
|
expect(result.isOk()).toBe(true);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
24
|
+
const expected = result.unwrapOr([]);
|
|
25
|
+
expect(expected).toHaveLength(2);
|
|
26
|
+
expect(expected).toEqual(expect.arrayContaining([
|
|
27
|
+
expect.objectContaining({ id: "a" }),
|
|
28
|
+
expect.objectContaining({ id: "b" }),
|
|
29
|
+
]));
|
|
30
30
|
});
|
|
31
31
|
it("retrieves a codemod by id and returns undefined when missing", async () => {
|
|
32
32
|
const registry = new LocalCodemodRegistry();
|
|
@@ -34,14 +34,12 @@ describe("LocalCodemodRegistry", () => {
|
|
|
34
34
|
registry.add(a);
|
|
35
35
|
const found = await registry.getById("a");
|
|
36
36
|
expect(found.isOk()).toBe(true);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
37
|
+
const expected = found.unwrapOr(undefined);
|
|
38
|
+
expect(expected).toBe(a);
|
|
40
39
|
const missing = await registry.getById("nope");
|
|
41
40
|
expect(missing.isOk()).toBe(true);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
41
|
+
const missingValue = missing.unwrapOr(undefined);
|
|
42
|
+
expect(missingValue).toBeUndefined();
|
|
45
43
|
});
|
|
46
44
|
it("overwrites an existing codemod when adding with the same id", async () => {
|
|
47
45
|
const registry = new LocalCodemodRegistry();
|
|
@@ -51,9 +49,8 @@ describe("LocalCodemodRegistry", () => {
|
|
|
51
49
|
registry.add(second);
|
|
52
50
|
const byId = await registry.getById("a");
|
|
53
51
|
expect(byId.isOk()).toBe(true);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
52
|
+
const byIdValue = byId.unwrapOr(undefined);
|
|
53
|
+
expect(byIdValue).toBe(second);
|
|
54
|
+
expect(byIdValue).not.toBe(first);
|
|
58
55
|
});
|
|
59
56
|
});
|
|
@@ -31,10 +31,9 @@ describe("applyCodemodById", () => {
|
|
|
31
31
|
};
|
|
32
32
|
const result = await applyCodemodById(registry, info)("missing-id");
|
|
33
33
|
expect(result.isErr()).toBe(true);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
34
|
+
const value = result.isErr() ? result.error : null;
|
|
35
|
+
expect(value).toBeInstanceOf(Error);
|
|
36
|
+
expect(value?.message).toBe("Codemod with id missing-id not found");
|
|
38
37
|
});
|
|
39
38
|
it("propagates getById errors", async () => {
|
|
40
39
|
const registryError = new Error("registry failed");
|
|
@@ -46,9 +45,9 @@ describe("applyCodemodById", () => {
|
|
|
46
45
|
};
|
|
47
46
|
const result = await applyCodemodById(registry, info)("foo");
|
|
48
47
|
expect(result.isErr()).toBe(true);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
const value = result.isErr() ? result.error : null;
|
|
49
|
+
expect(value).toBeInstanceOf(Error);
|
|
50
|
+
expect(value?.message).toContain(registryError.message);
|
|
52
51
|
});
|
|
53
52
|
it("propagates apply errors", async () => {
|
|
54
53
|
const applyError = new Error("apply failed");
|
|
@@ -65,9 +64,8 @@ describe("applyCodemodById", () => {
|
|
|
65
64
|
};
|
|
66
65
|
const result = await applyCodemodById(registry, info)("foo");
|
|
67
66
|
expect(result.isErr()).toBe(true);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
67
|
+
const value = result.isErr() ? result.error : null;
|
|
68
|
+
expect(value).toBeInstanceOf(Error);
|
|
69
|
+
expect(value?.message).toContain(applyError.message);
|
|
72
70
|
});
|
|
73
71
|
});
|
|
@@ -31,8 +31,7 @@ describe("listCodemods", () => {
|
|
|
31
31
|
};
|
|
32
32
|
const result = await listCodemods(registry)();
|
|
33
33
|
expect(result.isErr()).toBe(true);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
34
|
+
const value = result.isErr() ? result.error : null;
|
|
35
|
+
expect(value).toBe(error);
|
|
37
36
|
});
|
|
38
37
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/dx-cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A CLI useful to manage DX tools.",
|
|
6
6
|
"repository": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"semver": "^7.7.4",
|
|
48
48
|
"yaml": "^2.8.2",
|
|
49
49
|
"zod": "^4.3.6",
|
|
50
|
-
"@pagopa/dx-savemoney": "^0.2.
|
|
50
|
+
"@pagopa/dx-savemoney": "^0.2.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@tsconfig/node24": "24.0.4",
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"@types/node": "^22.19.15",
|
|
56
56
|
"@types/semver": "^7.7.1",
|
|
57
57
|
"@vitest/coverage-v8": "^3.2.4",
|
|
58
|
-
"eslint": "^
|
|
58
|
+
"eslint": "^10.1.0",
|
|
59
59
|
"memfs": "^4.51.1",
|
|
60
60
|
"plop": "^4.0.5",
|
|
61
61
|
"prettier": "3.8.1",
|
|
62
62
|
"typescript": "~5.9.3",
|
|
63
63
|
"vitest": "^3.2.4",
|
|
64
64
|
"vitest-mock-extended": "^3.1.0",
|
|
65
|
-
"@pagopa/eslint-config": "^
|
|
65
|
+
"@pagopa/eslint-config": "^6.0.1"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=22.0.0"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
config {
|
|
2
|
+
format = "default"
|
|
3
|
+
call_module_type = "local"
|
|
4
|
+
force = false
|
|
5
|
+
disabled_by_default = false
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
plugin "terraform" {
|
|
9
|
+
enabled = true
|
|
10
|
+
preset = "recommended"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
# install the plugin by running 'tflint --init'
|
|
14
|
+
plugin "azurerm" {
|
|
15
|
+
enabled = true
|
|
16
|
+
version = "0.31.1"
|
|
17
|
+
source = "github.com/terraform-linters/tflint-ruleset-azurerm"
|
|
18
|
+
}
|