@memberjunction/testing-cli 0.0.1 → 2.119.0
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 +486 -29
- package/dist/commands/compare.d.ts +24 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +50 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/history.d.ts +23 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +47 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/list.d.ts +39 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +177 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/report.d.ts +22 -0
- package/dist/commands/report.d.ts.map +1 -0
- package/dist/commands/report.js +46 -0
- package/dist/commands/report.js.map +1 -0
- package/dist/commands/run.d.ts +21 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +139 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/suite.d.ts +21 -0
- package/dist/commands/suite.d.ts.map +1 -0
- package/dist/commands/suite.js +105 -0
- package/dist/commands/suite.js.map +1 -0
- package/dist/commands/validate.d.ts +33 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +266 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/mj-provider.d.ts +10 -0
- package/dist/lib/mj-provider.d.ts.map +1 -0
- package/dist/lib/mj-provider.js +205 -0
- package/dist/lib/mj-provider.js.map +1 -0
- package/dist/types.d.ts +103 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/config-loader.d.ts +42 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +70 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/output-formatter.d.ts +64 -0
- package/dist/utils/output-formatter.d.ts.map +1 -0
- package/dist/utils/output-formatter.js +280 -0
- package/dist/utils/output-formatter.js.map +1 -0
- package/dist/utils/spinner-manager.d.ts +43 -0
- package/dist/utils/spinner-manager.d.ts.map +1 -0
- package/dist/utils/spinner-manager.js +89 -0
- package/dist/utils/spinner-manager.js.map +1 -0
- package/package.json +38 -7
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview List command implementation
|
|
3
|
+
* @module @memberjunction/testing-cli
|
|
4
|
+
*/
|
|
5
|
+
import { UserInfo } from '@memberjunction/core';
|
|
6
|
+
import { ListFlags } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* List command - List available tests, suites, and types
|
|
9
|
+
*/
|
|
10
|
+
export declare class ListCommand {
|
|
11
|
+
/**
|
|
12
|
+
* Execute the list command
|
|
13
|
+
*
|
|
14
|
+
* @param flags - Command flags
|
|
15
|
+
* @param contextUser - Optional user context (will be fetched if not provided)
|
|
16
|
+
*/
|
|
17
|
+
execute(flags: ListFlags, contextUser?: UserInfo): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* List test types
|
|
20
|
+
*/
|
|
21
|
+
private listTestTypes;
|
|
22
|
+
/**
|
|
23
|
+
* List test suites
|
|
24
|
+
*/
|
|
25
|
+
private listTestSuites;
|
|
26
|
+
/**
|
|
27
|
+
* List tests
|
|
28
|
+
*/
|
|
29
|
+
private listTests;
|
|
30
|
+
/**
|
|
31
|
+
* Get test count for a suite
|
|
32
|
+
*/
|
|
33
|
+
private getTestCountForSuite;
|
|
34
|
+
/**
|
|
35
|
+
* Format tags for display
|
|
36
|
+
*/
|
|
37
|
+
private formatTags;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAKrC;;GAEG;AACH,qBAAa,WAAW;IACpB;;;;;OAKG;IACG,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCtE;;OAEG;IACH,OAAO,CAAC,aAAa;IAerB;;OAEG;IACH,OAAO,CAAC,cAAc;IA0BtB;;OAEG;IACH,OAAO,CAAC,SAAS;IA6DjB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;OAEG;IACH,OAAO,CAAC,UAAU;CAUrB"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview List command implementation
|
|
4
|
+
* @module @memberjunction/testing-cli
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ListCommand = void 0;
|
|
11
|
+
const testing_engine_1 = require("@memberjunction/testing-engine");
|
|
12
|
+
const output_formatter_1 = require("../utils/output-formatter");
|
|
13
|
+
const mj_provider_1 = require("../lib/mj-provider");
|
|
14
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
15
|
+
/**
|
|
16
|
+
* List command - List available tests, suites, and types
|
|
17
|
+
*/
|
|
18
|
+
class ListCommand {
|
|
19
|
+
/**
|
|
20
|
+
* Execute the list command
|
|
21
|
+
*
|
|
22
|
+
* @param flags - Command flags
|
|
23
|
+
* @param contextUser - Optional user context (will be fetched if not provided)
|
|
24
|
+
*/
|
|
25
|
+
async execute(flags, contextUser) {
|
|
26
|
+
try {
|
|
27
|
+
// Initialize MJ provider (database connection and metadata)
|
|
28
|
+
await (0, mj_provider_1.initializeMJProvider)();
|
|
29
|
+
// Get context user after initialization if not provided
|
|
30
|
+
if (!contextUser) {
|
|
31
|
+
contextUser = await (0, mj_provider_1.getContextUser)();
|
|
32
|
+
}
|
|
33
|
+
const engine = testing_engine_1.TestEngine.Instance;
|
|
34
|
+
await engine.Config(false, contextUser);
|
|
35
|
+
if (flags.types) {
|
|
36
|
+
this.listTestTypes(engine);
|
|
37
|
+
}
|
|
38
|
+
else if (flags.suites) {
|
|
39
|
+
this.listTestSuites(engine, flags);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.listTests(engine, flags);
|
|
43
|
+
}
|
|
44
|
+
// Clean up resources
|
|
45
|
+
await (0, mj_provider_1.closeMJProvider)();
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error(output_formatter_1.OutputFormatter.formatError('Failed to list tests', error));
|
|
49
|
+
// Clean up resources before exit
|
|
50
|
+
try {
|
|
51
|
+
await (0, mj_provider_1.closeMJProvider)();
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// Ignore cleanup errors
|
|
55
|
+
}
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* List test types
|
|
61
|
+
*/
|
|
62
|
+
listTestTypes(engine) {
|
|
63
|
+
const types = engine.TestTypes;
|
|
64
|
+
console.log(chalk_1.default.bold(`\nTest Types (${types.length}):\n`));
|
|
65
|
+
for (const type of types) {
|
|
66
|
+
console.log(chalk_1.default.cyan(` ${type.Name}`));
|
|
67
|
+
if (type.Description) {
|
|
68
|
+
console.log(chalk_1.default.gray(` ${type.Description}`));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
console.log('');
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* List test suites
|
|
75
|
+
*/
|
|
76
|
+
listTestSuites(engine, flags) {
|
|
77
|
+
let suites = engine.TestSuites;
|
|
78
|
+
// Apply filters
|
|
79
|
+
if (flags.status) {
|
|
80
|
+
suites = suites.filter(s => s.Status?.toLowerCase() === flags.status?.toLowerCase());
|
|
81
|
+
}
|
|
82
|
+
console.log(chalk_1.default.bold(`\nTest Suites (${suites.length}):\n`));
|
|
83
|
+
for (const suite of suites) {
|
|
84
|
+
const testCount = this.getTestCountForSuite(engine, suite);
|
|
85
|
+
console.log(chalk_1.default.cyan(` ${suite.Name}`) + chalk_1.default.gray(` (${testCount} tests)`));
|
|
86
|
+
if (suite.Description) {
|
|
87
|
+
console.log(chalk_1.default.gray(` ${suite.Description}`));
|
|
88
|
+
}
|
|
89
|
+
if (flags.verbose && suite.Configuration) {
|
|
90
|
+
console.log(chalk_1.default.gray(` Config: ${suite.Configuration}`));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
console.log('');
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* List tests
|
|
97
|
+
*/
|
|
98
|
+
listTests(engine, flags) {
|
|
99
|
+
let tests = engine.Tests;
|
|
100
|
+
// Apply filters
|
|
101
|
+
if (flags.type) {
|
|
102
|
+
const type = engine.GetTestTypeByName(flags.type);
|
|
103
|
+
if (type) {
|
|
104
|
+
tests = tests.filter(t => t.TypeID === type.ID);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (flags.tag) {
|
|
108
|
+
tests = tests.filter(t => {
|
|
109
|
+
if (!t.Tags)
|
|
110
|
+
return false;
|
|
111
|
+
try {
|
|
112
|
+
const tags = JSON.parse(t.Tags);
|
|
113
|
+
return tags.includes(flags.tag);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (flags.status) {
|
|
121
|
+
tests = tests.filter(t => t.Status?.toLowerCase() === flags.status?.toLowerCase());
|
|
122
|
+
}
|
|
123
|
+
// Group by type
|
|
124
|
+
const typeMap = new Map();
|
|
125
|
+
const types = engine.TestTypes;
|
|
126
|
+
for (const test of tests) {
|
|
127
|
+
const type = types.find(t => t.ID === test.TypeID);
|
|
128
|
+
const typeName = type?.Name || 'Unknown';
|
|
129
|
+
if (!typeMap.has(typeName)) {
|
|
130
|
+
typeMap.set(typeName, []);
|
|
131
|
+
}
|
|
132
|
+
typeMap.get(typeName).push(test);
|
|
133
|
+
}
|
|
134
|
+
console.log(chalk_1.default.bold(`\nAvailable Tests (${tests.length}):\n`));
|
|
135
|
+
for (const [typeName, testsInType] of typeMap) {
|
|
136
|
+
console.log(chalk_1.default.bold.cyan(`${typeName} (${testsInType.length}):`));
|
|
137
|
+
for (const test of testsInType) {
|
|
138
|
+
const tags = this.formatTags(test.Tags);
|
|
139
|
+
console.log(` ${chalk_1.default.white(test.Name)} ${tags}`);
|
|
140
|
+
if (flags.verbose && test.Description) {
|
|
141
|
+
console.log(chalk_1.default.gray(` ${test.Description}`));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
console.log('');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get test count for a suite
|
|
149
|
+
*/
|
|
150
|
+
getTestCountForSuite(engine, suite) {
|
|
151
|
+
if (!suite.Configuration)
|
|
152
|
+
return 0;
|
|
153
|
+
try {
|
|
154
|
+
const config = JSON.parse(suite.Configuration);
|
|
155
|
+
return config.testIds?.length || 0;
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return 0;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Format tags for display
|
|
163
|
+
*/
|
|
164
|
+
formatTags(tagsJson) {
|
|
165
|
+
if (!tagsJson)
|
|
166
|
+
return '';
|
|
167
|
+
try {
|
|
168
|
+
const tags = JSON.parse(tagsJson);
|
|
169
|
+
return chalk_1.default.gray(`Tags: ${tags.join(', ')}`);
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
return '';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.ListCommand = ListCommand;
|
|
177
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,mEAA4D;AAI5D,gEAA4D;AAC5D,oDAA2F;AAC3F,kDAA0B;AAE1B;;GAEG;AACH,MAAa,WAAW;IACpB;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,KAAgB,EAAE,WAAsB;QAClD,IAAI,CAAC;YACD,4DAA4D;YAC5D,MAAM,IAAA,kCAAoB,GAAE,CAAC;YAE7B,wDAAwD;YACxD,IAAI,CAAC,WAAW,EAAE,CAAC;gBACf,WAAW,GAAG,MAAM,IAAA,4BAAc,GAAE,CAAC;YACzC,CAAC;YAED,MAAM,MAAM,GAAG,2BAAU,CAAC,QAAQ,CAAC;YACnC,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;YAExC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBACtB,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACvC,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAClC,CAAC;YAED,qBAAqB;YACrB,MAAM,IAAA,6BAAe,GAAE,CAAC;QAE5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,kCAAe,CAAC,WAAW,CAAC,sBAAsB,EAAE,KAAc,CAAC,CAAC,CAAC;YAEnF,iCAAiC;YACjC,IAAI,CAAC;gBACD,MAAM,IAAA,6BAAe,GAAE,CAAC;YAC5B,CAAC;YAAC,M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ACL,CAAC;CACJ;AAvLD,kCAuLC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Report command implementation
|
|
3
|
+
* @module @memberjunction/testing-cli
|
|
4
|
+
*/
|
|
5
|
+
import { UserInfo } from '@memberjunction/core';
|
|
6
|
+
import { ReportFlags } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Report command - Generate test run reports
|
|
9
|
+
*
|
|
10
|
+
* Note: This is a placeholder implementation. Full reporting requires
|
|
11
|
+
* querying Test Run Results entities and aggregating historical data.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ReportCommand {
|
|
14
|
+
/**
|
|
15
|
+
* Execute the report command
|
|
16
|
+
*
|
|
17
|
+
* @param flags - Command flags
|
|
18
|
+
* @param contextUser - User context
|
|
19
|
+
*/
|
|
20
|
+
execute(flags: ReportFlags, contextUser: UserInfo): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/commands/report.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAW,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC;;;;;GAKG;AACH,qBAAa,aAAa;IACtB;;;;;OAKG;IACG,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAuB1E"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Report command implementation
|
|
4
|
+
* @module @memberjunction/testing-cli
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ReportCommand = void 0;
|
|
8
|
+
const output_formatter_1 = require("../utils/output-formatter");
|
|
9
|
+
/**
|
|
10
|
+
* Report command - Generate test run reports
|
|
11
|
+
*
|
|
12
|
+
* Note: This is a placeholder implementation. Full reporting requires
|
|
13
|
+
* querying Test Run Results entities and aggregating historical data.
|
|
14
|
+
*/
|
|
15
|
+
class ReportCommand {
|
|
16
|
+
/**
|
|
17
|
+
* Execute the report command
|
|
18
|
+
*
|
|
19
|
+
* @param flags - Command flags
|
|
20
|
+
* @param contextUser - User context
|
|
21
|
+
*/
|
|
22
|
+
async execute(flags, contextUser) {
|
|
23
|
+
try {
|
|
24
|
+
console.log(output_formatter_1.OutputFormatter.formatInfo('Report command not yet implemented'));
|
|
25
|
+
console.log('\nPlanned features:');
|
|
26
|
+
console.log(' - Generate reports for test runs over date ranges');
|
|
27
|
+
console.log(' - Include cost analysis and trends');
|
|
28
|
+
console.log(' - Export to JSON, Markdown, or HTML formats');
|
|
29
|
+
console.log(' - Aggregate pass rates and scores');
|
|
30
|
+
console.log('\nRequires:');
|
|
31
|
+
console.log(' - Test Run Results entity tracking');
|
|
32
|
+
console.log(' - Historical data aggregation');
|
|
33
|
+
// TODO: Implement full reporting
|
|
34
|
+
// - Query Test Run Results by date range
|
|
35
|
+
// - Group by test/suite
|
|
36
|
+
// - Calculate statistics (pass rate, avg score, total cost)
|
|
37
|
+
// - Generate formatted reports
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.error(output_formatter_1.OutputFormatter.formatError('Failed to generate report', error));
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ReportCommand = ReportCommand;
|
|
46
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/commands/report.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,gEAA4D;AAE5D;;;;;GAKG;AACH,MAAa,aAAa;IACtB;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,KAAkB,EAAE,WAAqB;QACnD,IAAI,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,kCAAe,CAAC,UAAU,CAAC,oCAAoC,CAAC,CAAC,CAAC;YAC9E,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;YACnE,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;YACpD,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;YACpD,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;YAE/C,iCAAiC;YACjC,yCAAyC;YACzC,wBAAwB;YACxB,4DAA4D;YAC5D,+BAA+B;QAEnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,kCAAe,CAAC,WAAW,CAAC,2BAA2B,EAAE,KAAc,CAAC,CAAC,CAAC;YACxF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;CACJ;AA9BD,sCA8BC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Run command implementation
|
|
3
|
+
* @module @memberjunction/testing-cli
|
|
4
|
+
*/
|
|
5
|
+
import { UserInfo } from '@memberjunction/core';
|
|
6
|
+
import { RunFlags } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Run command - Execute a single test or filtered set of tests
|
|
9
|
+
*/
|
|
10
|
+
export declare class RunCommand {
|
|
11
|
+
private spinner;
|
|
12
|
+
/**
|
|
13
|
+
* Execute the run command
|
|
14
|
+
*
|
|
15
|
+
* @param testId - Optional test ID to run
|
|
16
|
+
* @param flags - Command flags
|
|
17
|
+
* @param contextUser - Optional user context (will be fetched if not provided)
|
|
18
|
+
*/
|
|
19
|
+
execute(testId: string | undefined, flags: RunFlags, contextUser?: UserInfo): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAMpC;;GAEG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,OAAO,CAAwB;IAEvC;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CA2HpG"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Run command implementation
|
|
4
|
+
* @module @memberjunction/testing-cli
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.RunCommand = void 0;
|
|
8
|
+
const testing_engine_1 = require("@memberjunction/testing-engine");
|
|
9
|
+
const output_formatter_1 = require("../utils/output-formatter");
|
|
10
|
+
const spinner_manager_1 = require("../utils/spinner-manager");
|
|
11
|
+
const config_loader_1 = require("../utils/config-loader");
|
|
12
|
+
const mj_provider_1 = require("../lib/mj-provider");
|
|
13
|
+
/**
|
|
14
|
+
* Run command - Execute a single test or filtered set of tests
|
|
15
|
+
*/
|
|
16
|
+
class RunCommand {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.spinner = new spinner_manager_1.SpinnerManager();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Execute the run command
|
|
22
|
+
*
|
|
23
|
+
* @param testId - Optional test ID to run
|
|
24
|
+
* @param flags - Command flags
|
|
25
|
+
* @param contextUser - Optional user context (will be fetched if not provided)
|
|
26
|
+
*/
|
|
27
|
+
async execute(testId, flags, contextUser) {
|
|
28
|
+
try {
|
|
29
|
+
// Initialize MJ provider (database connection and metadata)
|
|
30
|
+
await (0, mj_provider_1.initializeMJProvider)();
|
|
31
|
+
// Get context user after initialization if not provided
|
|
32
|
+
if (!contextUser) {
|
|
33
|
+
contextUser = await (0, mj_provider_1.getContextUser)();
|
|
34
|
+
}
|
|
35
|
+
const config = (0, config_loader_1.loadCLIConfig)();
|
|
36
|
+
const format = flags.format || config.defaultFormat;
|
|
37
|
+
const environment = flags.environment || config.defaultEnvironment;
|
|
38
|
+
// Get engine instance
|
|
39
|
+
const engine = testing_engine_1.TestEngine.Instance;
|
|
40
|
+
await engine.Config(false, contextUser);
|
|
41
|
+
let test;
|
|
42
|
+
if (testId) {
|
|
43
|
+
// Run specific test by ID
|
|
44
|
+
test = engine.GetTestByID(testId);
|
|
45
|
+
if (!test) {
|
|
46
|
+
console.error(output_formatter_1.OutputFormatter.formatError(`Test not found: ${testId}`));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (flags.name) {
|
|
51
|
+
// Run test by name
|
|
52
|
+
test = engine.GetTestByName(flags.name);
|
|
53
|
+
if (!test) {
|
|
54
|
+
console.error(output_formatter_1.OutputFormatter.formatError(`Test not found: ${flags.name}`));
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (flags.suite) {
|
|
59
|
+
// Run test suite (delegate to suite command)
|
|
60
|
+
console.error(output_formatter_1.OutputFormatter.formatError('Use "mj test suite" command to run test suites'));
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
else if (flags.tag || flags.category || flags.difficulty) {
|
|
64
|
+
// Run tests by filter
|
|
65
|
+
console.error(output_formatter_1.OutputFormatter.formatError('Filtered test execution not yet implemented'));
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
else if (flags.all) {
|
|
69
|
+
// Run all tests
|
|
70
|
+
console.error(output_formatter_1.OutputFormatter.formatError('Use "mj test suite" command to run all tests'));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
console.error(output_formatter_1.OutputFormatter.formatError('Must specify test ID, --name, or other filter'));
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
// Dry run mode
|
|
78
|
+
if (flags.dryRun) {
|
|
79
|
+
console.log(output_formatter_1.OutputFormatter.formatInfo(`Would run test: ${test.Name}`));
|
|
80
|
+
console.log(output_formatter_1.OutputFormatter.formatInfo(`Type: ${test.Type}`));
|
|
81
|
+
console.log(output_formatter_1.OutputFormatter.formatInfo(`Environment: ${environment}`));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// Execute test
|
|
85
|
+
this.spinner.start(`Running test: ${test.Name}...`);
|
|
86
|
+
const result = await engine.RunTest(test.ID, {
|
|
87
|
+
environment,
|
|
88
|
+
verbose: flags.verbose
|
|
89
|
+
}, contextUser);
|
|
90
|
+
this.spinner.stop();
|
|
91
|
+
// Handle both single result and array of results (RepeatCount > 1)
|
|
92
|
+
if (Array.isArray(result)) {
|
|
93
|
+
// Multiple iterations - display summary and all results
|
|
94
|
+
console.log(output_formatter_1.OutputFormatter.formatInfo(`Ran ${result.length} iterations`));
|
|
95
|
+
let allPassed = true;
|
|
96
|
+
for (const iterationResult of result) {
|
|
97
|
+
const output = output_formatter_1.OutputFormatter.formatTestResult(iterationResult, format);
|
|
98
|
+
console.log(output);
|
|
99
|
+
if (iterationResult.status !== 'Passed') {
|
|
100
|
+
allPassed = false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Write to file if requested (write all results as JSON array)
|
|
104
|
+
if (flags.output) {
|
|
105
|
+
output_formatter_1.OutputFormatter.writeToFile(JSON.stringify(result, null, 2), flags.output);
|
|
106
|
+
}
|
|
107
|
+
// Clean up resources
|
|
108
|
+
await (0, mj_provider_1.closeMJProvider)();
|
|
109
|
+
// Exit with appropriate code (pass only if all iterations passed)
|
|
110
|
+
process.exit(allPassed ? 0 : 1);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// Single result
|
|
114
|
+
const output = output_formatter_1.OutputFormatter.formatTestResult(result, format);
|
|
115
|
+
console.log(output);
|
|
116
|
+
// Write to file if requested
|
|
117
|
+
output_formatter_1.OutputFormatter.writeToFile(output, flags.output);
|
|
118
|
+
// Clean up resources
|
|
119
|
+
await (0, mj_provider_1.closeMJProvider)();
|
|
120
|
+
// Exit with appropriate code
|
|
121
|
+
process.exit(result.status === 'Passed' ? 0 : 1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
this.spinner.fail();
|
|
126
|
+
console.error(output_formatter_1.OutputFormatter.formatError('Failed to run test', error));
|
|
127
|
+
// Clean up resources before exit
|
|
128
|
+
try {
|
|
129
|
+
await (0, mj_provider_1.closeMJProvider)();
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Ignore cleanup errors
|
|
133
|
+
}
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.RunCommand = RunCommand;
|
|
139
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mEAA4D;AAG5D,gEAA4D;AAC5D,8DAA0D;AAC1D,0DAAuD;AACvD,oDAA2F;AAE3F;;GAEG;AACH,MAAa,UAAU;IAAvB;QACY,YAAO,GAAG,IAAI,gCAAc,EAAE,CAAC;IAoI3C,CAAC;IAlIG;;;;;;OAMG;IACH,KAAK,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;gBAChB,MAAM,MAAM,GAAG,kCAAe,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAChE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEpB,6BAA6B;gBAC7B,kCAAe,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAElD,qBAAqB;gBACrB,MAAM,IAAA,6BAAe,GAAE,CAAC;gBAExB,6BAA6B;gBAC7B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACrD,CAAC;QAEL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,kCAAe,CAAC,WAAW,CAAC,oBAAoB,EAAE,KAAc,CAAC,CAAC,CAAC;YAEjF,iCAAiC;YACjC,IAAI,CAAC;gBACD,MAAM,IAAA,6BAAe,GAAE,CAAC;YAC5B,CAAC;YAAC,MAAM,CAAC;gBACL,wBAAwB;YAC5B,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;CACJ;AArID,gCAqIC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Suite command implementation
|
|
3
|
+
* @module @memberjunction/testing-cli
|
|
4
|
+
*/
|
|
5
|
+
import { UserInfo } from '@memberjunction/core';
|
|
6
|
+
import { SuiteFlags } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Suite command - Execute a test suite
|
|
9
|
+
*/
|
|
10
|
+
export declare class SuiteCommand {
|
|
11
|
+
private spinner;
|
|
12
|
+
/**
|
|
13
|
+
* Execute the suite command
|
|
14
|
+
*
|
|
15
|
+
* @param suiteId - Test suite ID to run
|
|
16
|
+
* @param flags - Command flags
|
|
17
|
+
* @param contextUser - Optional user context (will be fetched if not provided)
|
|
18
|
+
*/
|
|
19
|
+
execute(suiteId: string | undefined, flags: SuiteFlags, contextUser?: UserInfo): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=suite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../src/commands/suite.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAMtC;;GAEG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,OAAO,CAAwB;IAEvC;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAuFvG"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Suite command implementation
|
|
4
|
+
* @module @memberjunction/testing-cli
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SuiteCommand = void 0;
|
|
8
|
+
const testing_engine_1 = require("@memberjunction/testing-engine");
|
|
9
|
+
const output_formatter_1 = require("../utils/output-formatter");
|
|
10
|
+
const spinner_manager_1 = require("../utils/spinner-manager");
|
|
11
|
+
const config_loader_1 = require("../utils/config-loader");
|
|
12
|
+
const mj_provider_1 = require("../lib/mj-provider");
|
|
13
|
+
/**
|
|
14
|
+
* Suite command - Execute a test suite
|
|
15
|
+
*/
|
|
16
|
+
class SuiteCommand {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.spinner = new spinner_manager_1.SpinnerManager();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Execute the suite command
|
|
22
|
+
*
|
|
23
|
+
* @param suiteId - Test suite ID to run
|
|
24
|
+
* @param flags - Command flags
|
|
25
|
+
* @param contextUser - Optional user context (will be fetched if not provided)
|
|
26
|
+
*/
|
|
27
|
+
async execute(suiteId, flags, contextUser) {
|
|
28
|
+
try {
|
|
29
|
+
// Initialize MJ provider (database connection and metadata)
|
|
30
|
+
console.log('Initializing MJ provider...');
|
|
31
|
+
await (0, mj_provider_1.initializeMJProvider)();
|
|
32
|
+
console.log('MJ provider initialized successfully');
|
|
33
|
+
// Get context user after initialization if not provided
|
|
34
|
+
if (!contextUser) {
|
|
35
|
+
contextUser = await (0, mj_provider_1.getContextUser)();
|
|
36
|
+
}
|
|
37
|
+
const config = (0, config_loader_1.loadCLIConfig)();
|
|
38
|
+
const format = flags.format || config.defaultFormat;
|
|
39
|
+
// Get engine instance
|
|
40
|
+
console.log('Getting TestEngine instance...');
|
|
41
|
+
const engine = testing_engine_1.TestEngine.Instance;
|
|
42
|
+
console.log('Configuring TestEngine...');
|
|
43
|
+
await engine.Config(false, contextUser);
|
|
44
|
+
console.log(`TestEngine configured. Test Types loaded: ${engine.TestTypes?.length || 0}`);
|
|
45
|
+
console.log(`Test Suites loaded: ${engine.TestSuites?.length || 0}`);
|
|
46
|
+
console.log(`Tests loaded: ${engine.Tests?.length || 0}`);
|
|
47
|
+
let suite;
|
|
48
|
+
if (suiteId) {
|
|
49
|
+
// Run specific suite by ID
|
|
50
|
+
console.log(`Looking for suite by ID: ${suiteId}`);
|
|
51
|
+
suite = engine.GetTestSuiteByID(suiteId);
|
|
52
|
+
if (!suite) {
|
|
53
|
+
console.error(output_formatter_1.OutputFormatter.formatError(`Test suite not found: ${suiteId}`));
|
|
54
|
+
console.error(`Available suites: ${engine.TestSuites?.map(s => s.Name).join(', ') || 'none'}`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (flags.name) {
|
|
59
|
+
// Run suite by name
|
|
60
|
+
console.log(`Looking for suite by name: ${flags.name}`);
|
|
61
|
+
suite = engine.GetTestSuiteByName(flags.name);
|
|
62
|
+
if (!suite) {
|
|
63
|
+
console.error(output_formatter_1.OutputFormatter.formatError(`Test suite not found: ${flags.name}`));
|
|
64
|
+
console.error(`Available suites: ${engine.TestSuites?.map(s => s.Name).join(', ') || 'none'}`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
console.error(output_formatter_1.OutputFormatter.formatError('Must specify suite ID or --name'));
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
// Execute suite
|
|
73
|
+
this.spinner.start(`Running test suite: ${suite.Name}...`);
|
|
74
|
+
// Note: parallel and failFast are handled by RunSuite internally
|
|
75
|
+
// We only pass the standard TestRunOptions
|
|
76
|
+
const result = await engine.RunSuite(suite.ID, {
|
|
77
|
+
verbose: flags.verbose
|
|
78
|
+
}, contextUser);
|
|
79
|
+
this.spinner.stop();
|
|
80
|
+
// Format and display result
|
|
81
|
+
const output = output_formatter_1.OutputFormatter.formatSuiteResult(result, format);
|
|
82
|
+
console.log(output);
|
|
83
|
+
// Write to file if requested
|
|
84
|
+
output_formatter_1.OutputFormatter.writeToFile(output, flags.output);
|
|
85
|
+
// Clean up resources
|
|
86
|
+
await (0, mj_provider_1.closeMJProvider)();
|
|
87
|
+
// Exit with appropriate code (non-zero if any test failed)
|
|
88
|
+
process.exit(result.failedTests === 0 ? 0 : 1);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
this.spinner.fail();
|
|
92
|
+
console.error(output_formatter_1.OutputFormatter.formatError('Failed to run test suite', error));
|
|
93
|
+
// Clean up resources before exit
|
|
94
|
+
try {
|
|
95
|
+
await (0, mj_provider_1.closeMJProvider)();
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// Ignore cleanup errors
|
|
99
|
+
}
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.SuiteCommand = SuiteCommand;
|
|
105
|
+
//# sourceMappingURL=suite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite.js","sourceRoot":"","sources":["../../src/commands/suite.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mEAA4D;AAG5D,gEAA4D;AAC5D,8DAA0D;AAC1D,0DAAuD;AACvD,oDAA2F;AAE3F;;GAEG;AACH,MAAa,YAAY;IAAzB;QACY,YAAO,GAAG,IAAI,gCAAc,EAAE,CAAC;IAgG3C,CAAC;IA9FG;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,OAA2B,EAAE,KAAiB,EAAE,WAAsB;QAChF,IAAI,CAAC;YACD,4DAA4D;YAC5D,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YAC3C,MAAM,IAAA,kCAAoB,GAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;YAEpD,wDAAwD;YACxD,IAAI,CAAC,WAAW,EAAE,CAAC;gBACf,WAAW,GAAG,MAAM,IAAA,4BAAc,GAAE,CAAC;YACzC,CAAC;YAED,MAAM,MAAM,GAAG,IAAA,6BAAa,GAAE,CAAC;YAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC;YAEpD,sBAAsB;YACtB,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;YAC9C,MAAM,MAAM,GAAG,2BAAU,CAAC,QAAQ,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;YACzC,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;YACxC,OAAO,CAAC,GAAG,CAAC,6CAA6C,MAAM,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC;YAC1F,OAAO,CAAC,G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,CAAC,CAAC;YAEvF,iCAAiC;YACjC,IAAI,CAAC;gBACD,MAAM,IAAA,6BAAe,GAAE,CAAC;YAC5B,CAAC;YAAC,MAAM,CAAC;gBACL,wBAAwB;YAC5B,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;CACJ;AAjGD,oCAiGC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Validate command implementation
|
|
3
|
+
* @module @memberjunction/testing-cli
|
|
4
|
+
*/
|
|
5
|
+
import { UserInfo } from '@memberjunction/core';
|
|
6
|
+
import { ValidateFlags } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Validate command - Validate test definitions without executing
|
|
9
|
+
*/
|
|
10
|
+
export declare class ValidateCommand {
|
|
11
|
+
private spinner;
|
|
12
|
+
/**
|
|
13
|
+
* Execute the validate command
|
|
14
|
+
*
|
|
15
|
+
* @param testId - Optional test ID to validate
|
|
16
|
+
* @param flags - Command flags
|
|
17
|
+
* @param contextUser - Optional user context (will be fetched if not provided)
|
|
18
|
+
*/
|
|
19
|
+
execute(testId: string | undefined, flags: ValidateFlags, contextUser?: UserInfo): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Validate a single test
|
|
22
|
+
*/
|
|
23
|
+
private validateTest;
|
|
24
|
+
/**
|
|
25
|
+
* Display validation results
|
|
26
|
+
*/
|
|
27
|
+
private displayResults;
|
|
28
|
+
/**
|
|
29
|
+
* Save validation report to file
|
|
30
|
+
*/
|
|
31
|
+
private saveReport;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAkBzC;;GAEG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,OAAO,CAAwB;IAEvC;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IA6EtG;;OAEG;IACH,OAAO,CAAC,YAAY;IA4DpB;;OAEG;IACH,OAAO,CAAC,cAAc;IAuCtB;;OAEG;IACH,OAAO,CAAC,UAAU;CAqDrB"}
|