@abaplint/transpiler 2.0.52 → 2.0.55

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.
@@ -6,10 +6,17 @@ const abaplint = require("@abaplint/core");
6
6
  class UnitTest {
7
7
  // todo, move this method somewhere else, its much more than just unit test relevant
8
8
  initializationScript(reg, dbSetup, extraSetup, useImport) {
9
- let ret = `/* eslint-disable import/newline-after-import */
9
+ let ret = "";
10
+ if (useImport === true) {
11
+ ret = `/* eslint-disable import/newline-after-import */
12
+ import "./_top.mjs";\n`;
13
+ }
14
+ else {
15
+ ret = `/* eslint-disable import/newline-after-import */
10
16
  import runtime from "@abaplint/runtime";
11
- globalThis.abap = new runtime.ABAP();
12
- ${this.buildImports(reg, useImport)}
17
+ globalThis.abap = new runtime.ABAP();\n`;
18
+ }
19
+ ret += `${this.buildImports(reg, useImport)}
13
20
 
14
21
  export async function initializeABAP() {\n`;
15
22
  ret += ` const sqlite = \`${dbSetup.schemas.sqlite}\`;\n`;
@@ -67,7 +74,7 @@ async function run() {
67
74
  ret += ` ls_input.get().class_name.set("${obj.getName()}");
68
75
  ls_input.get().testclass_name.set("${def.name.toUpperCase()}");
69
76
  ls_input.get().method_name.set("${m.name.toUpperCase()}");
70
- abap.statements.append({source: ls_input, target: lt_input});`;
77
+ abap.statements.append({source: ls_input, target: lt_input});\n`;
71
78
  }
72
79
  }
73
80
  }
@@ -146,13 +153,13 @@ async function run() {
146
153
  }
147
154
  ret += `// -------------------END-------------------
148
155
  console.log(abap.console.get());
149
- fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
156
+ fs.writeFileSync(__dirname + path.sep + "_output.xml", unit.xUnitXML());
150
157
  } catch (e) {
151
158
  if (meth) {
152
159
  meth.fail();
153
160
  }
154
161
  console.log(abap.console.get());
155
- fs.writeFileSync(__dirname + path.sep + "output.xml", unit.xUnitXML());
162
+ fs.writeFileSync(__dirname + path.sep + "_output.xml", unit.xUnitXML());
156
163
  throw e;
157
164
  }
158
165
  }
@@ -166,7 +173,7 @@ run().then(() => {
166
173
  return ret;
167
174
  }
168
175
  buildImports(reg, useImport) {
169
- // note: ES modules are hoised, so use the dynamic import(), hmm, but why?
176
+ // note: ES modules are hoised, so use the dynamic import(), due to setting of globalThis.abap
170
177
  // todo, some sorting might be required? eg. a class constructor using constant from interface?
171
178
  // temporary sorting: by filename
172
179
  const list = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler",
3
- "version": "2.0.52",
3
+ "version": "2.0.55",
4
4
  "description": "Transpiler",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "author": "abaplint",
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@abaplint/core": "^2.91.6",
31
+ "@abaplint/core": "^2.91.7",
32
32
  "source-map": "^0.7.4"
33
33
  },
34
34
  "devDependencies": {