definition-generator-framework 1.12.0 → 1.12.2
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/.vscode/settings.json +13 -2
- package/dist/helpers/validator/custom-validators/reference.custom-validator.d.ts +1 -0
- package/dist/helpers/validator/custom-validators/reference.custom-validator.js +9 -4
- package/dist/helpers/validator/custom-validators/reference.custom-validator.js.map +1 -1
- package/dist/pre-made-components/events/2-script-test.d.ts +1 -6
- package/dist/pre-made-components/events/2-script-test.js +21 -3
- package/dist/pre-made-components/events/2-script-test.js.map +1 -1
- package/dist/pre-made-components/events/4-event-test.d.ts +3 -8
- package/dist/pre-made-components/events/4-event-test.js +6 -2
- package/dist/pre-made-components/events/4-event-test.js.map +1 -1
- package/dist/pre-made-components/events/helpers/script-testing.helper.d.ts +11 -2
- package/dist/pre-made-components/events/helpers/script-testing.helper.js +10 -3
- package/dist/pre-made-components/events/helpers/script-testing.helper.js.map +1 -1
- package/dist/pre-made-components/events/scripting-setup.d.ts +16 -5
- package/dist/pre-made-components/events/scripting-setup.js +34 -0
- package/dist/pre-made-components/events/scripting-setup.js.map +1 -1
- package/package.json +3 -3
- package/package.json.bak +3 -3
package/.vscode/settings.json
CHANGED
|
@@ -8,7 +8,18 @@
|
|
|
8
8
|
"terminal.integrated.shellIntegration.decorationsEnabled": "never",
|
|
9
9
|
"editor.wrappingIndent": "indent",
|
|
10
10
|
"editor.codeActionsOnSave": {
|
|
11
|
-
"source.
|
|
11
|
+
"source.fixAll.eslint": "always",
|
|
12
|
+
"source.organizeImports": "never",
|
|
13
|
+
"source.removeUnusedImports": "always"
|
|
12
14
|
},
|
|
13
|
-
"
|
|
15
|
+
"eslint.validate": [
|
|
16
|
+
"javascript",
|
|
17
|
+
"typescript"
|
|
18
|
+
],
|
|
19
|
+
"eslint.run": "onType",
|
|
20
|
+
"editor.formatOnSave": true,
|
|
21
|
+
"typescript.suggest.autoImports": true,
|
|
22
|
+
"typescript.updateImportsOnFileMove.enabled": "always",
|
|
23
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
24
|
+
"typescript.enablePromptUseWorkspaceTsdk": true
|
|
14
25
|
}
|
|
@@ -10,6 +10,7 @@ declare abstract class ReferenceCustomValidatorBase implements CustomStringValid
|
|
|
10
10
|
}
|
|
11
11
|
export declare class ReferenceCustomValidator extends ReferenceCustomValidatorBase {
|
|
12
12
|
readonly validate: (value: string, helpers: Joi.CustomHelpers) => any | ErrorReport;
|
|
13
|
+
private includeType;
|
|
13
14
|
private referencedComponents;
|
|
14
15
|
constructor(definitionComponentClasses: DefinitionComponentClassType<any> | DefinitionComponentClassType<any>[], options?: ReferenceCustomValidatorOptions);
|
|
15
16
|
}
|
|
@@ -48,7 +48,7 @@ class ReferenceCustomValidator extends ReferenceCustomValidatorBase {
|
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
this.validatePropertyExistence(referencedComponent, value, this.options);
|
|
51
|
-
if (this.
|
|
51
|
+
if (this.includeType) {
|
|
52
52
|
return {
|
|
53
53
|
value,
|
|
54
54
|
type: custom_validator_helper_1.CustomValidatorHelper.getDefinitionComponentName(referencedComponent)
|
|
@@ -64,9 +64,14 @@ class ReferenceCustomValidator extends ReferenceCustomValidatorBase {
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
this.referencedComponents = [];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
if (helpers_lib_1.Comparator.isArray(definitionComponentClasses)) {
|
|
68
|
+
this.includeType = true;
|
|
69
|
+
this.referencedComponents = definitionComponentClasses;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.includeType = false;
|
|
73
|
+
this.referencedComponents = [definitionComponentClasses];
|
|
74
|
+
}
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
exports.ReferenceCustomValidator = ReferenceCustomValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference.custom-validator.js","sourceRoot":"","sources":["../../../../src/helpers/validator/custom-validators/reference.custom-validator.ts"],"names":[],"mappings":";;;AAAA,6CAAoE;AAIpE,wDAAqD;AACrD,0EAAsE;AACtE,6FAAwF;AACxF,gGAA2F;AAI3F,MAAe,4BAA4B;IAKzC,YAAgC,OAAyC;QAAzC,YAAO,GAAP,OAAO,CAAkC;QAJhE,UAAK,GAAG,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"reference.custom-validator.js","sourceRoot":"","sources":["../../../../src/helpers/validator/custom-validators/reference.custom-validator.ts"],"names":[],"mappings":";;;AAAA,6CAAoE;AAIpE,wDAAqD;AACrD,0EAAsE;AACtE,6FAAwF;AACxF,gGAA2F;AAI3F,MAAe,4BAA4B;IAKzC,YAAgC,OAAyC;QAAzC,YAAO,GAAP,OAAO,CAAkC;QAJhE,UAAK,GAAG,yBAAyB,CAAC;IAIkC,CAAC;IAEpE,yBAAyB,CACjC,mBAAsD,EACtD,cAAsB,EACtB,OAAyC;QAEzC,IAAI,OAAO,EAAE,mBAAmB,EAAE,CAAC;YACjC,IAAI,UAAU,GAAG,wBAAU,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC;gBAC/D,CAAC,CAAC,OAAO,EAAE,mBAAmB;gBAC9B,CAAC,CAAC,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;YACnC,IAAI,aAAa,GAAG,kCAAe,CAAC,kBAAkB,CAAC,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;YAE7F,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;gBAChC,IAAI,sBAAsB,GAAG,aAAa,CAAC,CAAC,CAAC,2CAAmB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBACpG,IAAI,QAAQ,GAAG,wBAAU,CAAC,QAAQ,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;gBACzE,IAAI,CAAC,QAAQ,IAAI,CAAC,wBAAU,CAAC,OAAO,C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mBAAmB,GAAG,kCAAe,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAEnF,IAAI,eAAe,GAAG,+CAAqB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;YACxE,IAAI,eAAe,KAAK,OAAO,EAAE,CAAC;gBAChC,IAAI,sCAAsC,GAAG,kCAAe,CAAC,uBAAuB,CAAC,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;gBAClH,IAAI,CAAC,sCAAsC,EAAE,CAAC;oBAC5C,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,aAAa,2BAA2B,KAAK,GAAG,CAAC,CAAC;gBACzF,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,yBAAyB,CAAC,mBAAmB,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;oBACzE,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,0EAA0E,OAAO,CAAC,KAAK,CAAC,IACxF,sBAAsB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAC/D,CAAC;YACJ,CAAC;QACH,CAAC,CAAC;IAOF,CAAC;CACF;AApDD,oEAoDC"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { DefinitionComponent } from '../../decorators/definition-component';
|
|
2
2
|
import { Output } from '../../framework/interfaces';
|
|
3
|
-
import {
|
|
4
|
-
interface ScriptTestDefinition {
|
|
5
|
-
readonly script: string;
|
|
6
|
-
readonly cases: readonly ScriptTestCasesDefinition[];
|
|
7
|
-
}
|
|
3
|
+
import { ScriptTestDefinition } from './helpers/script-testing.helper';
|
|
8
4
|
export declare class ScriptTestComponent extends DefinitionComponent<ScriptTestDefinition> {
|
|
9
5
|
process(definitions: ScriptTestDefinition[], output: Output): Promise<void>;
|
|
10
6
|
private getLocationFinder;
|
|
11
7
|
}
|
|
12
|
-
export {};
|
|
@@ -49,20 +49,38 @@ let ScriptTestComponent = ScriptTestComponent_1 = class ScriptTestComponent exte
|
|
|
49
49
|
async process(definitions, output) {
|
|
50
50
|
let allScripts = definition_store_1.DefinitionStore.getDefinitions(_1_script_1.ScriptComponent);
|
|
51
51
|
let scriptTestingHelper = new script_testing_helper_1.ScriptTestingHelper(allScripts, scripting_setup_1.ScriptTestingInternal.scriptSimulatorFunctionsConstructor, this.getLocationFinder());
|
|
52
|
-
let
|
|
52
|
+
let testCasesFullDefinitions = definitions.map(definition => ({
|
|
53
53
|
cases: definition.cases,
|
|
54
54
|
script: definition_store_1.DefinitionStore.getDefinitionOrFail(_1_script_1.ScriptComponent, definition.script),
|
|
55
55
|
scriptInput: scripting_setup_1.ScriptTestingInternal.getScriptInput(definition.script),
|
|
56
56
|
testDefinitionRef: definition
|
|
57
|
-
}))
|
|
57
|
+
}));
|
|
58
|
+
let customTestCasesFullDefinitions = scripting_setup_1.ScriptTestingInternal.getCustomScriptTestCases().map(definition => ({
|
|
59
|
+
cases: definition.testDefinition.cases,
|
|
60
|
+
script: definition_store_1.DefinitionStore.getDefinitionOrFail(_1_script_1.ScriptComponent, definition.testDefinition.script),
|
|
61
|
+
scriptInput: scripting_setup_1.ScriptTestingInternal.getScriptInput(definition.testDefinition.script),
|
|
62
|
+
testDefinitionRef: definition.testDefinition,
|
|
63
|
+
customMessage: definition.customMessage
|
|
64
|
+
}));
|
|
65
|
+
let allTestDefinitions = testCasesFullDefinitions.concat(customTestCasesFullDefinitions);
|
|
66
|
+
let runtimeErrors = scriptTestingHelper.runTests(allTestDefinitions, output);
|
|
58
67
|
scriptTestingHelper.printErrors(runtimeErrors, output);
|
|
59
68
|
}
|
|
60
69
|
getLocationFinder() {
|
|
61
70
|
return {
|
|
62
71
|
getLocationOfDefinition: (key, path) => definition_store_1.DefinitionStore.getLocationInFileById(_1_script_1.ScriptComponent, key, path),
|
|
63
|
-
getLocationOfTestDefinition: (definition, path) =>
|
|
72
|
+
getLocationOfTestDefinition: (definition, path) => {
|
|
73
|
+
if (scripting_setup_1.ScriptTestingInternal.isCustomScriptTestCase(definition)) {
|
|
74
|
+
let errorMessage = `Internal error: custom script test case is failing. Definition: ${JSON.stringify(definition)}, Path: ${JSON.stringify(path)}`;
|
|
75
|
+
throw new Error(errorMessage);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return definition_store_1.DefinitionStore.getLocationInFile(ScriptTestComponent_1, definition, path);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
64
81
|
};
|
|
65
82
|
}
|
|
83
|
+
;
|
|
66
84
|
};
|
|
67
85
|
exports.ScriptTestComponent = ScriptTestComponent;
|
|
68
86
|
exports.ScriptTestComponent = ScriptTestComponent = ScriptTestComponent_1 = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2-script-test.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/2-script-test.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,8CAAsB;AAEtB,gFAA0G;AAC1G,uEAAmE;AAEnE,0CAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"2-script-test.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/2-script-test.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,8CAAsB;AAEtB,gFAA0G;AAC1G,uEAAmE;AAEnE,0CAA6C;AAC7C,2EAAyH;AACzH,uDAA0D;AAE1D,MAAM,kBAAkB,GAAG,aAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvD,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,KAAK;CACb,CAAC,CAAC,CAAC;AAEJ,MAAM,eAAe,GAAG,aAAG,CAAC,MAAM,EAAE;KACjC,IAAI,CAAC;IACJ,SAAS,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,2BAAe,CAAC,CAAC,QAAQ,EAAE;CAC9D,CAAC;KACD,MA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S,CAAC,UAAU,CAAC,WAAW,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;oBAClJ,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;gBAChC,CAAC;qBAAM,CAAC;oBACN,OAAO,kCAAe,CAAC,iBAAiB,CAAC,qBAAmB,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;gBAClF,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IAAA,CAAC;CACH,CAAA;AA/CY,kDAAmB;8BAAnB,mBAAmB;IAjB/B,IAAA,mDAA4B,EAAC;QAC5B,aAAa,EAAE,aAAa;QAC5B,gBAAgB,EAAE,aAAG,CAAC,MAAM,EAAE;aAC3B,IAAI,CAAC;YACJ,MAAM,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,2BAAe,CAAC,CAAC,QAAQ,EAAE;YAC1D,KAAK,EAAE,aAAG,CAAC,KAAK,EAAE;iBACf,KAAK,CACJ,aAAG,CAAC,MAAM,EAAE;iBACT,IAAI,CAAC;gBACJ,oBAAoB,EAAE,qBAAqB,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;aACrE,CAAC;iBACD,QAAQ,EAAE,CACd;iBACA,QAAQ,EAAE;SACd,CAAC;aACD,QAAQ,EAAE;KACd,CAAC;GACW,mBAAmB,CA+C/B"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { DefinitionComponent } from '../../decorators/definition-component';
|
|
2
2
|
import { Output } from '../../framework/interfaces';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly cases: readonly ScriptTestCasesDefinition[];
|
|
7
|
-
}
|
|
8
|
-
export declare class EventTestComponent extends DefinitionComponent<EventTestDefinition> {
|
|
9
|
-
process(definitions: EventTestDefinition[], output: Output): Promise<void>;
|
|
3
|
+
import { ScriptTestDefinition } from './helpers/script-testing.helper';
|
|
4
|
+
export declare class EventTestComponent extends DefinitionComponent<ScriptTestDefinition> {
|
|
5
|
+
process(definitions: ScriptTestDefinition[], output: Output): Promise<void>;
|
|
10
6
|
private getLocationFinder;
|
|
11
7
|
}
|
|
12
|
-
export {};
|
|
@@ -51,8 +51,8 @@ let EventTestComponent = EventTestComponent_1 = class EventTestComponent extends
|
|
|
51
51
|
let scriptTestingHelper = new script_testing_helper_1.ScriptTestingHelper(allScripts, scripting_setup_1.ScriptTestingInternal.eventSimulatorFunctionsConstructor, this.getLocationFinder());
|
|
52
52
|
let runtimeErrors = scriptTestingHelper.runTests(definitions.map(definition => ({
|
|
53
53
|
cases: definition.cases,
|
|
54
|
-
script: definition_store_1.DefinitionStore.getDefinitionOrFail(_3_event_1.EventComponent, definition.
|
|
55
|
-
scriptInput: scripting_setup_1.ScriptTestingInternal.getEventInput(definition.
|
|
54
|
+
script: definition_store_1.DefinitionStore.getDefinitionOrFail(_3_event_1.EventComponent, definition.script),
|
|
55
|
+
scriptInput: scripting_setup_1.ScriptTestingInternal.getEventInput(definition.script),
|
|
56
56
|
testDefinitionRef: definition
|
|
57
57
|
})), output);
|
|
58
58
|
scriptTestingHelper.printErrors(runtimeErrors, output);
|
|
@@ -80,6 +80,10 @@ exports.EventTestComponent = EventTestComponent = EventTestComponent_1 = __decor
|
|
|
80
80
|
.required()
|
|
81
81
|
})
|
|
82
82
|
.required()
|
|
83
|
+
.custom(value => ({
|
|
84
|
+
script: value.event,
|
|
85
|
+
cases: value.cases
|
|
86
|
+
}))
|
|
83
87
|
})
|
|
84
88
|
], EventTestComponent);
|
|
85
89
|
//# sourceMappingURL=4-event-test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4-event-test.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/4-event-test.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,8CAAsB;AAEtB,gFAA0G;AAC1G,uEAAmE;AAEnE,wCAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"4-event-test.js","sourceRoot":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A,mDAA4B,EAAC;QAC5B,aAAa,EAAE,YAAY;QAC3B,gBAAgB,EAAE,aAAG,CAAC,MAAM,EAAE;aAC3B,IAAI,CAAC;YACJ,KAAK,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,yBAAc,CAAC,CAAC,QAAQ,EAAE;YACxD,KAAK,EAAE,aAAG,CAAC,KAAK,EAAE;iBACf,KAAK,CACJ,aAAG,CAAC,MAAM,EAAE;iBACT,IAAI,CAAC;gBACJ,oBAAoB,EAAE,qBAAqB,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;aACrE,CAAC;iBACD,QAAQ,EAAE,CACd;iBACA,QAAQ,EAAE;SACd,CAAC;aACD,QAAQ,EAAE;aACV,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAChB,MAAM,EAAE,KAAK,CAAC,KAAK;YACnB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAC;KACN,CAAC;GACW,kBAAkB,CA+B9B"}
|
|
@@ -3,10 +3,19 @@ import { ErrorLog, LocationInFile, Output } from '../../../framework/interfaces'
|
|
|
3
3
|
export interface ScriptTestCasesDefinition {
|
|
4
4
|
readonly actionsBeforeTesting: readonly ScriptTestActionDefinition[];
|
|
5
5
|
}
|
|
6
|
-
export interface ScriptTestDefinition
|
|
6
|
+
export interface ScriptTestDefinition {
|
|
7
|
+
readonly script: string;
|
|
8
|
+
readonly cases: readonly ScriptTestCasesDefinition[];
|
|
9
|
+
}
|
|
10
|
+
export interface CustomScriptTestDefinition {
|
|
11
|
+
readonly testDefinition: ScriptTestDefinition;
|
|
12
|
+
readonly customMessage: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ScriptTestFullDefinition<T> {
|
|
7
15
|
readonly script: ScriptDefinition;
|
|
8
16
|
readonly testDefinitionRef: T;
|
|
9
17
|
readonly scriptInput: any;
|
|
18
|
+
readonly customMessage?: string;
|
|
10
19
|
readonly cases: readonly ScriptTestCasesDefinition[];
|
|
11
20
|
}
|
|
12
21
|
export interface ScriptTestingLocationFinder<T> {
|
|
@@ -18,7 +27,7 @@ export declare class ScriptTestingHelper<T> {
|
|
|
18
27
|
private locationFinder;
|
|
19
28
|
private scriptTestSimulator;
|
|
20
29
|
constructor(allScripts: ScriptDefinition[], functionsConstructor: new (input: any) => ScriptEngineSimulatorFunctions, locationFinder: ScriptTestingLocationFinder<T>);
|
|
21
|
-
runTests(testDefinitions:
|
|
30
|
+
runTests(testDefinitions: ScriptTestFullDefinition<T>[], output: Output): ErrorLog[];
|
|
22
31
|
printErrors(runtimeErrors: ErrorLog[], output: Output): void;
|
|
23
32
|
private prepareErrorLog;
|
|
24
33
|
}
|
|
@@ -17,6 +17,10 @@ class ScriptTestingHelper {
|
|
|
17
17
|
if (!errorEncountered) {
|
|
18
18
|
let jsEngine = new helpers_lib_1.JSEngine(new this.functionsConstructor(testDefinition.scriptInput), {});
|
|
19
19
|
try {
|
|
20
|
+
if (testDefinition.script.id === 'selectEvent') {
|
|
21
|
+
console.log(jsEngine.execute('selectEvent("event1")'));
|
|
22
|
+
console.log(jsEngine.duplicate().execute('selectEvent(5)'));
|
|
23
|
+
}
|
|
20
24
|
this.scriptTestSimulator.simulateScript(testDefinition.script, jsEngine, testCase.actionsBeforeTesting);
|
|
21
25
|
}
|
|
22
26
|
catch (e) {
|
|
@@ -40,12 +44,14 @@ class ScriptTestingHelper {
|
|
|
40
44
|
}
|
|
41
45
|
prepareErrorLog(e, testDefinition, testCaseIndex, output) {
|
|
42
46
|
if (e instanceof script_engine_lib_1.SimulationError) {
|
|
47
|
+
let errorDescription = testDefinition.customMessage ? testDefinition.customMessage + '\n' + e.message : e.message;
|
|
43
48
|
return {
|
|
44
|
-
description:
|
|
49
|
+
description: errorDescription,
|
|
45
50
|
location: this.locationFinder.getLocationOfDefinition(e.location.scriptId, e.location.path)
|
|
46
51
|
};
|
|
47
52
|
}
|
|
48
53
|
else if (e instanceof script_engine_lib_1.ActionsBeforeTestingError) {
|
|
54
|
+
let errorDescription = testDefinition.customMessage ? testDefinition.customMessage + '\n' + e.message : e.message;
|
|
49
55
|
let executedActionLocation = this.locationFinder.getLocationOfTestDefinition(testDefinition.testDefinitionRef, [
|
|
50
56
|
'cases',
|
|
51
57
|
`${testCaseIndex}`,
|
|
@@ -53,7 +59,7 @@ class ScriptTestingHelper {
|
|
|
53
59
|
`${e.actionIndex}`
|
|
54
60
|
]);
|
|
55
61
|
return {
|
|
56
|
-
description:
|
|
62
|
+
description: errorDescription,
|
|
57
63
|
location: executedActionLocation
|
|
58
64
|
};
|
|
59
65
|
}
|
|
@@ -62,8 +68,9 @@ class ScriptTestingHelper {
|
|
|
62
68
|
let executionHistoryAddition = `Running the test: ${output.convertLocationInFileToLink(testLocation)}\n\n`;
|
|
63
69
|
let executionHistoryStart = e.message.indexOf('\n', e.message.indexOf('Execution history')) + 1;
|
|
64
70
|
let fullMessage = e.message.slice(0, executionHistoryStart) + executionHistoryAddition + e.message.slice(executionHistoryStart);
|
|
71
|
+
let errorDescription = testDefinition.customMessage ? testDefinition.customMessage + '\n' + fullMessage : fullMessage;
|
|
65
72
|
return {
|
|
66
|
-
description:
|
|
73
|
+
description: errorDescription,
|
|
67
74
|
location: this.locationFinder.getLocationOfDefinition(e.location.scriptId, e.location.path)
|
|
68
75
|
};
|
|
69
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-testing.helper.js","sourceRoot":"","sources":["../../../../src/pre-made-components/events/helpers/script-testing.helper.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AACvC,yDAQ2B;
|
|
1
|
+
{"version":3,"file":"script-testing.helper.js","sourceRoot":"","sources":["../../../../src/pre-made-components/events/helpers/script-testing.helper.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AACvC,yDAQ2B;AA+B3B,MAAa,mBAAmB;IAG9B,YACE,UAA8B,EACtB,oBAAwE,EACxE,cAA8C;QAD9C,yBAAoB,GAApB,oBAAoB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
|
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import { ScriptEngineSimulatorFunctions } from 'script-engine-lib';
|
|
2
|
+
import { CustomScriptTestDefinition, ScriptTestCasesDefinition, ScriptTestDefinition } from './helpers/script-testing.helper';
|
|
2
3
|
export declare class ScriptTesting<ScriptInputType, EventInputType> {
|
|
3
4
|
constructor(scriptSimulatorFunctionsConstructor: new (input: ScriptInputType) => ScriptEngineSimulatorFunctions, eventSimulatorFunctionsConstructor: new (input: EventInputType) => ScriptEngineSimulatorFunctions, richTextTags: Set<string> | undefined);
|
|
4
5
|
setScriptInput(scriptId: string, input: ScriptInputType): void;
|
|
5
6
|
setEventInput(eventId: string, input: EventInputType): void;
|
|
7
|
+
addCustomScriptTestCase(customMessage: string, scriptId: string, testCase: ScriptTestCasesDefinition): void;
|
|
8
|
+
addCustomEventTestCase(customMessage: string, eventId: string, testCase: ScriptTestCasesDefinition): void;
|
|
6
9
|
}
|
|
7
10
|
export declare class ScriptTestingInternal {
|
|
8
11
|
private static _scriptSimulatorFunctionsConstructor;
|
|
9
12
|
private static _eventSimulatorFunctionsConstructor;
|
|
10
13
|
private static _scriptInputs;
|
|
11
14
|
private static _eventInputs;
|
|
15
|
+
private static _scriptTestCases;
|
|
16
|
+
private static _eventTestCases;
|
|
12
17
|
private static _richTextTags;
|
|
13
|
-
static get scriptSimulatorFunctionsConstructor(): new (...args:
|
|
14
|
-
static get eventSimulatorFunctionsConstructor(): new (...args:
|
|
18
|
+
static get scriptSimulatorFunctionsConstructor(): new (...args: unknown[]) => ScriptEngineSimulatorFunctions;
|
|
19
|
+
static get eventSimulatorFunctionsConstructor(): new (...args: unknown[]) => ScriptEngineSimulatorFunctions;
|
|
15
20
|
static get richTextTags(): Set<string> | undefined;
|
|
16
21
|
static get isInitialized(): boolean;
|
|
17
|
-
static setup(scriptSimulatorFunctionsConstructor: new (...args:
|
|
18
|
-
static getScriptInput(scriptId: string):
|
|
19
|
-
static getEventInput(eventId: string):
|
|
22
|
+
static setup(scriptSimulatorFunctionsConstructor: new (...args: unknown[]) => ScriptEngineSimulatorFunctions, eventSimulatorFunctionsConstructor: new (...args: unknown[]) => ScriptEngineSimulatorFunctions, richTextTags: Set<string> | undefined): void;
|
|
23
|
+
static getScriptInput(scriptId: string): unknown;
|
|
24
|
+
static getEventInput(eventId: string): unknown;
|
|
25
|
+
static getCustomScriptTestCases(): CustomScriptTestDefinition[];
|
|
26
|
+
static getCustomEventTestCases(): CustomScriptTestDefinition[];
|
|
27
|
+
static isCustomScriptTestCase(testCase: ScriptTestDefinition): boolean;
|
|
28
|
+
static isCustomEventTestCase(testCase: ScriptTestDefinition): boolean;
|
|
20
29
|
static setScriptInput(scriptId: string, input: unknown): void;
|
|
21
30
|
static setEventInput(eventId: string, input: unknown): void;
|
|
31
|
+
static addCustomScriptTestCase(scriptId: string, testCase: ScriptTestCasesDefinition, customMessage: string): void;
|
|
32
|
+
static addCustomEventTestCase(eventId: string, testCase: ScriptTestCasesDefinition, customMessage: string): void;
|
|
22
33
|
}
|
|
@@ -12,11 +12,19 @@ class ScriptTesting {
|
|
|
12
12
|
setEventInput(eventId, input) {
|
|
13
13
|
ScriptTestingInternal.setEventInput(eventId, input);
|
|
14
14
|
}
|
|
15
|
+
addCustomScriptTestCase(customMessage, scriptId, testCase) {
|
|
16
|
+
ScriptTestingInternal.addCustomScriptTestCase(scriptId, testCase, customMessage);
|
|
17
|
+
}
|
|
18
|
+
addCustomEventTestCase(customMessage, eventId, testCase) {
|
|
19
|
+
ScriptTestingInternal.addCustomEventTestCase(eventId, testCase, customMessage);
|
|
20
|
+
}
|
|
15
21
|
}
|
|
16
22
|
exports.ScriptTesting = ScriptTesting;
|
|
17
23
|
class ScriptTestingInternal {
|
|
18
24
|
static { this._scriptInputs = new Map(); }
|
|
19
25
|
static { this._eventInputs = new Map(); }
|
|
26
|
+
static { this._scriptTestCases = new Map(); }
|
|
27
|
+
static { this._eventTestCases = new Map(); }
|
|
20
28
|
static get scriptSimulatorFunctionsConstructor() {
|
|
21
29
|
if (!this._scriptSimulatorFunctionsConstructor) {
|
|
22
30
|
throw new Error('ScriptSimulatorFunctionsConstructor is not set');
|
|
@@ -46,6 +54,18 @@ class ScriptTestingInternal {
|
|
|
46
54
|
static getEventInput(eventId) {
|
|
47
55
|
return this._eventInputs.get(eventId);
|
|
48
56
|
}
|
|
57
|
+
static getCustomScriptTestCases() {
|
|
58
|
+
return Array.from(this._scriptTestCases.values());
|
|
59
|
+
}
|
|
60
|
+
static getCustomEventTestCases() {
|
|
61
|
+
return Array.from(this._eventTestCases.values());
|
|
62
|
+
}
|
|
63
|
+
static isCustomScriptTestCase(testCase) {
|
|
64
|
+
return this._scriptTestCases.has(testCase.script);
|
|
65
|
+
}
|
|
66
|
+
static isCustomEventTestCase(testCase) {
|
|
67
|
+
return this._eventTestCases.has(testCase.script);
|
|
68
|
+
}
|
|
49
69
|
static setScriptInput(scriptId, input) {
|
|
50
70
|
if (this._scriptInputs.has(scriptId)) {
|
|
51
71
|
throw new Error(`Script input for ${scriptId} already set`);
|
|
@@ -58,6 +78,20 @@ class ScriptTestingInternal {
|
|
|
58
78
|
}
|
|
59
79
|
this._eventInputs.set(eventId, input);
|
|
60
80
|
}
|
|
81
|
+
static addCustomScriptTestCase(scriptId, testCase, customMessage) {
|
|
82
|
+
let customTestDefinition = {
|
|
83
|
+
testDefinition: { script: scriptId, cases: [testCase] },
|
|
84
|
+
customMessage: `Prebuild Test Case:\n${customMessage}`
|
|
85
|
+
};
|
|
86
|
+
this._scriptTestCases.set(scriptId, customTestDefinition);
|
|
87
|
+
}
|
|
88
|
+
static addCustomEventTestCase(eventId, testCase, customMessage) {
|
|
89
|
+
let customTestDefinition = {
|
|
90
|
+
testDefinition: { script: eventId, cases: [testCase] },
|
|
91
|
+
customMessage: `Prebuild Test Case:\n${customMessage}`
|
|
92
|
+
};
|
|
93
|
+
this._eventTestCases.set(eventId, customTestDefinition);
|
|
94
|
+
}
|
|
61
95
|
}
|
|
62
96
|
exports.ScriptTestingInternal = ScriptTestingInternal;
|
|
63
97
|
//# sourceMappingURL=scripting-setup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scripting-setup.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/scripting-setup.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"scripting-setup.js","sourceRoot":"","sources":["../../../src/pre-made-components/events/scripting-setup.ts"],"names":[],"mappings":";;;AAIA,sBAAsB;AACtB,MAAa,aAAa;IACxB,YACE,mCAAmG,EACnG,kCAAiG,EACjG,YAAqC;QAErC,qBAAqB,CAAC,KAAK,CAAC,mCAAmC,EAAE,kCAAkC,EAAE,YAAY,CAAC,CAAC;IACrH,CAAC;IAED,cAAc,CAAC,QAAgB,EAAE,KAAsB;QACrD,qBAAqB,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,aAAa,CAAC,OAAe,EAAE,KAAqB;QAClD,qBAAqB,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,uBAAuB,CAAC,aAAqB,EAAE,QAAgB,EAAE,QAAmC;QAClG,qBAAqB,CAAC,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IACnF,CAAC;IAED,sBAAsB,CAAC,aAAqB,EAAE,OAAe,EAAE,QAAmC;QAChG,qBAAqB,CAAC,sBAAsB,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IACjF,CAAC;CACF;AAxBD,sCAwBC;AAED,MAAa,qBAAqB;aAIjB,kBAAa,GAAyB,IAAI,GAAG,EAAE,CAAC;aAChD,iBAAY,GAAyB,IAAI,GAAG,EAAE,CAAC;aAE/C,qBAAgB,GAA4C,IAAI,GAAG,EAAE,CAAC;aACtE,oBAAe,GAA4C,IAAI,GAAG,EAAE,CAAC;IAIpF,MAAM,KAAK,mCAAmC;QAC5C,IAAI,CAAC,I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AI,oBAAoB,GAA+B;YACrD,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE;YACtD,aAAa,EAAE,wBAAwB,aAAa,EAAE;SACvD,CAAC;QAEF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAC1D,CAAC;;AAvGH,sDAwGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "definition-generator-framework",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "Definition Generator Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"postpack": "mv package.json.bak package.json"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"helpers-lib": "1.13.
|
|
38
|
+
"helpers-lib": "1.13.7",
|
|
39
39
|
"image-size": "1.1.1",
|
|
40
40
|
"joi": "17.11.0",
|
|
41
41
|
"prettier": "3.3.3",
|
|
42
42
|
"jsonpath-plus": "8.1.0",
|
|
43
|
-
"script-engine-lib": "0.4.
|
|
43
|
+
"script-engine-lib": "0.4.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/glob": "8.1.0",
|
package/package.json.bak
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "definition-generator-framework",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "Definition Generator Framework",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"postpack": "mv package.json.bak package.json"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"helpers-lib": "1.13.
|
|
38
|
+
"helpers-lib": "1.13.7",
|
|
39
39
|
"image-size": "1.1.1",
|
|
40
40
|
"joi": "17.11.0",
|
|
41
41
|
"prettier": "3.3.3",
|
|
42
42
|
"jsonpath-plus": "8.1.0",
|
|
43
|
-
"script-engine-lib": "0.4.
|
|
43
|
+
"script-engine-lib": "0.4.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/glob": "8.1.0",
|