From 5dabf6356fbf13348d6a36923e771c9659f160f2 Mon Sep 17 00:00:00 2001 From: Tiago Bento Date: Fri, 27 Sep 2024 09:56:34 -0400 Subject: [PATCH] Fix test command of sonataflow-image-common --- packages/sonataflow-image-common/package.json | 4 ++-- scripts/check-junit-report-results/tests/index.test.js | 10 ++++++++++ .../check-junit-report-results/tests/reports/empty.xml | 0 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 scripts/check-junit-report-results/tests/reports/empty.xml diff --git a/packages/sonataflow-image-common/package.json b/packages/sonataflow-image-common/package.json index fa075f37ab8..2a307a83e2d 100644 --- a/packages/sonataflow-image-common/package.json +++ b/packages/sonataflow-image-common/package.json @@ -13,10 +13,10 @@ "url": "https://github.com/apache/incubator-kie-tools/issues" }, "scripts": { - "build:prod": "run-script-if --bool \"$(build-env tests.run)\" --then \"pnpm test\"", + "build:prod": "pnpm test", "install": "node install.js", "test": "run-script-os", - "test:linux:darwin": "mkdir -p dist-tests && rm -rf dist-tests/* && make -C ./resources bats || $(build-env tests.ignoreFailures) && mv dist-tests/report.xml dist-tests/junit-report.xml || true", + "test:linux:darwin": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env tests.run)\" --then \"mkdir -p dist-tests\" \"rm -rf dist-tests/*\" \"make -C ./resources bats\" --finally \"touch dist-tests/report.xml\" \"mv dist-tests/report.xml dist-tests/junit-report.xml\"", "test:win32": "echo \"Tests are skipped in Windows\"" }, "devDependencies": { diff --git a/scripts/check-junit-report-results/tests/index.test.js b/scripts/check-junit-report-results/tests/index.test.js index 5838520b957..8052a80fd46 100644 --- a/scripts/check-junit-report-results/tests/index.test.js +++ b/scripts/check-junit-report-results/tests/index.test.js @@ -2,6 +2,16 @@ const parseFile = require("../src/parseFile"); const path = require("path"); describe("Parsing", () => { + test("empty", () => { + const failed = []; + const passed = []; + + parseFile(path.join(__dirname, "./reports/empty.xml"), failed, passed); + + expect(failed.length).toStrictEqual(0); + expect(passed.length).toStrictEqual(0); + }); + test("cypress", () => { const failed = []; const passed = []; diff --git a/scripts/check-junit-report-results/tests/reports/empty.xml b/scripts/check-junit-report-results/tests/reports/empty.xml new file mode 100644 index 00000000000..e69de29bb2d