@abaplint/transpiler 2.0.52 → 2.0.53
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/unit_test.js +11 -4
- package/package.json +1 -1
package/build/src/unit_test.js
CHANGED
|
@@ -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 =
|
|
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
|
-
|
|
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`;
|
|
@@ -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(),
|
|
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 = [];
|