add transpiler setup running unit tests (#195)

* add transpiler setup

* definitions top

* comment unit step
This commit is contained in:
Lars Hvam 2023-04-26 16:27:09 +02:00 committed by oblomov
parent cd0f68286f
commit 9ee7cb6f7b
7 changed files with 148 additions and 12 deletions

View File

@ -1,4 +1,4 @@
name: downport
name: test
on:
pull_request:
@ -7,7 +7,7 @@ permissions:
contents: read
jobs:
lint-and-merge:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
@ -17,4 +17,6 @@ jobs:
node-version: '16'
- run: npm ci
- run: npm run downport
- run: npm run transpile
# - run: npm run unit

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
downport
node_modules
node_modules
output

View File

@ -20,6 +20,7 @@
"check_include": true,
"check_syntax": true,
"global_class": true,
"definitions_top": true,
"implement_methods": true,
"method_implemented_twice": true,
"parser_error": true,

110
package-lock.json generated
View File

@ -9,13 +9,16 @@
"version": "1.0.0",
"license": "MIT",
"devDependencies": {
"@abaplint/cli": "^2.95.49"
"@abaplint/cli": "^2.97.17",
"@abaplint/database-sqlite": "^2.6.0",
"@abaplint/runtime": "^2.6.33",
"@abaplint/transpiler-cli": "^2.6.33"
}
},
"node_modules/@abaplint/cli": {
"version": "2.95.49",
"resolved": "https://registry.npmjs.org/@abaplint/cli/-/cli-2.95.49.tgz",
"integrity": "sha512-MylgxcSS6TcM5qz+g5PNL9amEvGxWieaccJDVoXeAtcv4OYh2f9NCnMj37SAdHwxYMSXYy4VijRh1k3i9nNOTw==",
"version": "2.97.17",
"resolved": "https://registry.npmjs.org/@abaplint/cli/-/cli-2.97.17.tgz",
"integrity": "sha512-40I3hkiBH0b6BBX8KQ7sac0wvQlHGI5XWzdtBW+GrewFk8pAnO5L6ntCZK8WUf925hkXHNvDnQMD/bev2BDJTw==",
"dev": true,
"bin": {
"abaplint": "abaplint"
@ -23,13 +26,106 @@
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/@abaplint/database-sqlite": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@abaplint/database-sqlite/-/database-sqlite-2.6.0.tgz",
"integrity": "sha512-+iGSd0XA2YO8DoXjYvz+qBZQii08E02OfersEubADeY2FjmGE34EZ3YksZPRpC3mjSXhqaG6+TT3ucOju+4B1g==",
"dev": true,
"dependencies": {
"sql.js": "^1.8.0"
}
},
"node_modules/@abaplint/runtime": {
"version": "2.6.33",
"resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-2.6.33.tgz",
"integrity": "sha512-/9AstHFDlkrxoMN/5eQi28zY8p+9CpFRFcbb6YZIxnojxn1yOYSBHWOLfOKAyq0Qo8ZRynZg6oGoTgbCe7Qz1g==",
"dev": true,
"dependencies": {
"temporal-polyfill": "^0.1.1"
}
},
"node_modules/@abaplint/transpiler-cli": {
"version": "2.6.33",
"resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-2.6.33.tgz",
"integrity": "sha512-0O4PbYFuqnSWcEoc03uWihf+W8EHXRRr531JPi42qy2vd7VwjswUv81jJgaPD7AnwAN1JhrMbNlkZbL0EpyDvg==",
"dev": true,
"bin": {
"abap_transpile": "abap_transpile"
}
},
"node_modules/sql.js": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/sql.js/-/sql.js-1.8.0.tgz",
"integrity": "sha512-3HD8pSkZL+5YvYUI8nlvNILs61ALqq34xgmF+BHpqxe68yZIJ1H+sIVIODvni25+CcxHUxDyrTJUL0lE/m7afw==",
"dev": true
},
"node_modules/temporal-polyfill": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/temporal-polyfill/-/temporal-polyfill-0.1.1.tgz",
"integrity": "sha512-/5e4EVRA0wBI/bEhWLirSjwUg1lELhQyTXxw9zNbVhqjKvI9BLczs+3wtsoD9sn3HN2ImAMW5XJQwAiXgWT+GA==",
"dev": true,
"dependencies": {
"temporal-spec": "~0.1.0"
}
},
"node_modules/temporal-spec": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/temporal-spec/-/temporal-spec-0.1.0.tgz",
"integrity": "sha512-sMNggMeS6trCgMQuudgFHhX1gtBK3e+AT1zGrMsFYG1wlqtRT5E9rcvm3I1iNlvHpJX/3DO6L4qtWAuEl/T04Q==",
"dev": true
}
},
"dependencies": {
"@abaplint/cli": {
"version": "2.95.49",
"resolved": "https://registry.npmjs.org/@abaplint/cli/-/cli-2.95.49.tgz",
"integrity": "sha512-MylgxcSS6TcM5qz+g5PNL9amEvGxWieaccJDVoXeAtcv4OYh2f9NCnMj37SAdHwxYMSXYy4VijRh1k3i9nNOTw==",
"version": "2.97.17",
"resolved": "https://registry.npmjs.org/@abaplint/cli/-/cli-2.97.17.tgz",
"integrity": "sha512-40I3hkiBH0b6BBX8KQ7sac0wvQlHGI5XWzdtBW+GrewFk8pAnO5L6ntCZK8WUf925hkXHNvDnQMD/bev2BDJTw==",
"dev": true
},
"@abaplint/database-sqlite": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@abaplint/database-sqlite/-/database-sqlite-2.6.0.tgz",
"integrity": "sha512-+iGSd0XA2YO8DoXjYvz+qBZQii08E02OfersEubADeY2FjmGE34EZ3YksZPRpC3mjSXhqaG6+TT3ucOju+4B1g==",
"dev": true,
"requires": {
"sql.js": "^1.8.0"
}
},
"@abaplint/runtime": {
"version": "2.6.33",
"resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-2.6.33.tgz",
"integrity": "sha512-/9AstHFDlkrxoMN/5eQi28zY8p+9CpFRFcbb6YZIxnojxn1yOYSBHWOLfOKAyq0Qo8ZRynZg6oGoTgbCe7Qz1g==",
"dev": true,
"requires": {
"temporal-polyfill": "^0.1.1"
}
},
"@abaplint/transpiler-cli": {
"version": "2.6.33",
"resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-2.6.33.tgz",
"integrity": "sha512-0O4PbYFuqnSWcEoc03uWihf+W8EHXRRr531JPi42qy2vd7VwjswUv81jJgaPD7AnwAN1JhrMbNlkZbL0EpyDvg==",
"dev": true
},
"sql.js": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/sql.js/-/sql.js-1.8.0.tgz",
"integrity": "sha512-3HD8pSkZL+5YvYUI8nlvNILs61ALqq34xgmF+BHpqxe68yZIJ1H+sIVIODvni25+CcxHUxDyrTJUL0lE/m7afw==",
"dev": true
},
"temporal-polyfill": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/temporal-polyfill/-/temporal-polyfill-0.1.1.tgz",
"integrity": "sha512-/5e4EVRA0wBI/bEhWLirSjwUg1lELhQyTXxw9zNbVhqjKvI9BLczs+3wtsoD9sn3HN2ImAMW5XJQwAiXgWT+GA==",
"dev": true,
"requires": {
"temporal-spec": "~0.1.0"
}
},
"temporal-spec": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/temporal-spec/-/temporal-spec-0.1.0.tgz",
"integrity": "sha512-sMNggMeS6trCgMQuudgFHhX1gtBK3e+AT1zGrMsFYG1wlqtRT5E9rcvm3I1iNlvHpJX/3DO6L4qtWAuEl/T04Q==",
"dev": true
}
}

View File

@ -4,7 +4,10 @@
"version": "1.0.0",
"description": "Development of UI5 Apps in pure ABAP. Follow this project on [twitter](https://twitter.com/OblomovDev) to keep up to date!",
"scripts": {
"downport": "rm -rf downport && cp -r src downport && abaplint --fix abaplint-downport.jsonc"
"downport": "rm -rf downport && cp -r src downport && abaplint --fix abaplint-downport.jsonc",
"unit": "echo RUNNING && node output/index.mjs",
"transpile": "rm -rf output && abap_transpile test/abap_transpile.json",
"test": "npm run downport && npm run transpile && npm run unit"
},
"repository": {
"type": "git",
@ -16,6 +19,9 @@
},
"homepage": "https://github.com/oblomov-dev/abap2UI5#readme",
"devDependencies": {
"@abaplint/cli": "^2.95.49"
"@abaplint/cli": "^2.97.17",
"@abaplint/database-sqlite": "^2.6.0",
"@abaplint/runtime": "^2.6.33",
"@abaplint/transpiler-cli": "^2.6.33"
}
}

22
test/abap_transpile.json Normal file
View File

@ -0,0 +1,22 @@
{
"input_folder": "downport",
"input_filter": [],
"output_folder": "output",
"libs": [
{
"url": "https://github.com/open-abap/open-abap-core"
}
],
"write_unit_tests": true,
"write_source_map": true,
"options": {
"ignoreSyntaxCheck": false,
"addFilenames": true,
"addCommonJS": true,
"unknownTypes": "runtimeError",
"keywords": ["return", "in", "class"],
"extraSetup": "../test/setup.mjs",
"skip": [
]
}
}

8
test/setup.mjs Normal file
View File

@ -0,0 +1,8 @@
import {SQLiteDatabaseClient} from "@abaplint/database-sqlite";
export async function setup(abap, schemas, insert) {
abap.context.databaseConnections["DEFAULT"] = new SQLiteDatabaseClient();
await abap.context.databaseConnections["DEFAULT"].connect();
await abap.context.databaseConnections["DEFAULT"].execute(schemas.sqlite);
await abap.context.databaseConnections["DEFAULT"].execute(insert);
}