Skip to content

Commit c4c9bba

Browse files
committed
feat: Made output verbose to help with debugging
1 parent 7df9e6c commit c4c9bba

4 files changed

Lines changed: 24 additions & 19 deletions

File tree

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codify-plugin-test",
3-
"version": "0.0.47",
3+
"version": "0.0.50",
44
"description": "",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
@@ -10,7 +10,8 @@
1010
"license": "ISC",
1111
"scripts": {
1212
"test": "echo \"Error: no test specified\" && exit 1",
13-
"start": "tsx ./src/index.ts"
13+
"start": "tsx ./src/index.ts",
14+
"prepublishOnly": "tsc"
1415
},
1516
"dependencies": {
1617
"ajv": "^8.12.0",
@@ -36,7 +37,7 @@
3637
"tsx": "^4.7.3",
3738
"typescript": "^5",
3839
"vitest": "^1.4.0",
39-
"codify-plugin-lib": "1.0.130"
40+
"codify-plugin-lib": "1.0.171"
4041
},
4142
"engines": {
4243
"node": ">=18.0.0"

src/plugin-process.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class PluginProcess {
5858
async initialize(): Promise<InitializeResponseData> {
5959
return CodifyTestUtils.sendMessageAndAwaitResponse(this.childProcess, {
6060
cmd: 'initialize',
61-
data: {},
61+
data: { verbosityLevel: 3 },
6262
requestId: nanoid(6),
6363
});
6464
}

src/plugin-tester.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class PluginTester {
1616
configs: ResourceConfig[],
1717
options?: {
1818
skipUninstall?: boolean,
19+
skipImport?: boolean,
1920
validatePlan?: (plans: PlanResponseData[]) => Promise<void> | void
2021
validateApply?: (plans: PlanResponseData[]) => Promise<void> | void,
2122
validateDestroy?: (plans: PlanResponseData[]) => Promise<void> | void,
@@ -87,23 +88,25 @@ export class PluginTester {
8788
plugin.kill();
8889
}
8990

90-
const importPlugin = new PluginProcess(pluginPath);
91-
try {
92-
console.info(chalk.cyan('Testing import...'))
91+
if (!options?.skipImport) {
92+
const importPlugin = new PluginProcess(pluginPath);
93+
try {
94+
console.info(chalk.cyan('Testing import...'))
9395

94-
const importResults = [];
95-
for (const config of configs) {
96-
const { coreParameters, parameters } = splitUserConfig(config);
97-
98-
const importResult = await importPlugin.import({ core: coreParameters, parameters })
99-
importResults.push(importResult);
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+
}
101103

102-
if (options?.validateImport) {
103-
await options.validateImport(importResults.map((r) => r.result[0]));
104+
if (options?.validateImport) {
105+
await options.validateImport(importResults.map((r) => r.result[0]));
106+
}
107+
} finally {
108+
importPlugin.kill();
104109
}
105-
} finally {
106-
importPlugin.kill();
107110
}
108111

109112
if (options?.testModify) {

test/test-plugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export interface TestConfig2 extends StringIndexedObject {
2626
export class TestResource extends Resource<TestConfig> {
2727
getSettings(): ResourceSettings<TestConfig> {
2828
return {
29-
id: 'test'
29+
id: 'test',
30+
allowMultiple: true,
3031
};
3132
}
3233

0 commit comments

Comments
 (0)