@abaplint/transpiler 1.7.43 → 1.7.44
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/build/src/index.js +1 -1
- package/build/src/types.d.ts +1 -1
- package/build/src/unit_test.d.ts +1 -1
- package/build/src/unit_test.js +6 -3
- package/package.json +1 -1
package/build/src/index.js
CHANGED
|
@@ -36,7 +36,7 @@ class Transpiler {
|
|
|
36
36
|
const output = {
|
|
37
37
|
objects: [],
|
|
38
38
|
unitTestScript: new unit_test_1.UnitTest().unitTestScript(reg, (_a = this.options) === null || _a === void 0 ? void 0 : _a.skip, (_b = this.options) === null || _b === void 0 ? void 0 : _b.only),
|
|
39
|
-
|
|
39
|
+
unitTestScriptOpen: new unit_test_1.UnitTest().unitTestScriptOpen(reg, (_c = this.options) === null || _c === void 0 ? void 0 : _c.skip, (_d = this.options) === null || _d === void 0 ? void 0 : _d.only),
|
|
40
40
|
initializationScript: new unit_test_1.UnitTest().initializationScript(reg, dbSetup),
|
|
41
41
|
databaseSetup: dbSetup,
|
|
42
42
|
reg: reg,
|
package/build/src/types.d.ts
CHANGED
package/build/src/unit_test.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare type TestMethodList = {
|
|
|
6
6
|
}[];
|
|
7
7
|
export declare class UnitTest {
|
|
8
8
|
initializationScript(reg: abaplint.IRegistry, dbSetup: string): string;
|
|
9
|
-
|
|
9
|
+
unitTestScriptOpen(reg: abaplint.IRegistry, _skip?: TestMethodList, _only?: TestMethodList): string;
|
|
10
10
|
unitTestScript(reg: abaplint.IRegistry, skip?: TestMethodList, _only?: TestMethodList): string;
|
|
11
11
|
private buildImports;
|
|
12
12
|
}
|
package/build/src/unit_test.js
CHANGED
|
@@ -19,7 +19,7 @@ export async function initializeABAP(settings) {\n`;
|
|
|
19
19
|
ret += `}`;
|
|
20
20
|
return ret;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
unitTestScriptOpen(reg, _skip, _only) {
|
|
23
23
|
let ret = `/* eslint-disable curly */
|
|
24
24
|
import fs from "fs";
|
|
25
25
|
import path from "path";
|
|
@@ -38,6 +38,10 @@ async function run() {
|
|
|
38
38
|
if (reg.isDependency(obj) || !(obj instanceof abaplint.Objects.Class)) {
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
|
+
const hasTestFile = obj.getFiles().some(f => { return f.getFilename().includes(".testclasses."); });
|
|
42
|
+
if (hasTestFile === true) {
|
|
43
|
+
ret += ` await import("./${obj.getName().toLowerCase()}.${obj.getType().toLowerCase()}.testclasses.mjs");\n`;
|
|
44
|
+
}
|
|
41
45
|
for (const file of obj.getABAPFiles()) {
|
|
42
46
|
for (const def of file.getInfo().listClassDefinitions()) {
|
|
43
47
|
if (def.isForTesting === false || def.isGlobal === true || def.methods.length === 0) {
|
|
@@ -48,8 +52,7 @@ async function run() {
|
|
|
48
52
|
if (m.isForTesting === false) {
|
|
49
53
|
continue;
|
|
50
54
|
}
|
|
51
|
-
ret += `
|
|
52
|
-
ls_input.get().class_name.set("${obj.getName()}");
|
|
55
|
+
ret += ` ls_input.get().class_name.set("${obj.getName()}");
|
|
53
56
|
ls_input.get().testclass_name.set("${def.name.toUpperCase()}");
|
|
54
57
|
ls_input.get().method_name.set("${m.name.toUpperCase()}");
|
|
55
58
|
abap.statements.append({source: ls_input, target: lt_input});`;
|