codify-plugin-test 0.0.47 → 0.0.48
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/package.json +1 -1
- package/src/plugin-tester.ts +17 -14
package/package.json
CHANGED
package/src/plugin-tester.ts
CHANGED
|
@@ -16,6 +16,7 @@ export class PluginTester {
|
|
|
16
16
|
configs: ResourceConfig[],
|
|
17
17
|
options?: {
|
|
18
18
|
skipUninstall?: boolean,
|
|
19
|
+
skipImport?: boolean,
|
|
19
20
|
validatePlan?: (plans: PlanResponseData[]) => Promise<void> | void
|
|
20
21
|
validateApply?: (plans: PlanResponseData[]) => Promise<void> | void,
|
|
21
22
|
validateDestroy?: (plans: PlanResponseData[]) => Promise<void> | void,
|
|
@@ -87,23 +88,25 @@ export class PluginTester {
|
|
|
87
88
|
plugin.kill();
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
if (!options?.skipImport) {
|
|
92
|
+
const importPlugin = new PluginProcess(pluginPath);
|
|
93
|
+
try {
|
|
94
|
+
console.info(chalk.cyan('Testing import...'))
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
const importResults = [];
|
|
97
|
+
for (const config of configs) {
|
|
98
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
99
|
+
|
|
100
|
+
const importResult = await importPlugin.import({ core: coreParameters, parameters })
|
|
101
|
+
importResults.push(importResult);
|
|
102
|
+
}
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
if (options?.validateImport) {
|
|
105
|
+
await options.validateImport(importResults.map((r) => r.result[0]));
|
|
106
|
+
}
|
|
107
|
+
} finally {
|
|
108
|
+
importPlugin.kill();
|
|
104
109
|
}
|
|
105
|
-
} finally {
|
|
106
|
-
importPlugin.kill();
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
if (options?.testModify) {
|