From e9d204daabfb770636ae1c1782620b9e8634785d Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Sat, 28 Sep 2024 03:49:14 +0200 Subject: [PATCH] Code coverage for JS --- ci/drone.yml | 3 +++ scripts/run-tests.sh | 2 +- tests/js/math/domain.mjs | 1 + tests/python/test_debug.py | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ci/drone.yml b/ci/drone.yml index b79c656..4ff14ff 100644 --- a/ci/drone.yml +++ b/ci/drone.yml @@ -26,6 +26,9 @@ steps: - name: Unit Tests image: ad5001/ubuntu-pyside-xvfb:linux-6-latest-latex commands: + - apt update + - apt install -y npm + - npm install -D - xvfb-run bash scripts/run-tests.sh when: event: [ push, tag ] diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 52d4413..257d748 100644 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -3,5 +3,5 @@ cd "$(dirname "$(readlink -f "$0" || realpath "$0")")/.." # Run python tests PYTHONPATH="$PYTHONPATH:." pytest --cov=LogarithmPlotter --cov-report term-missing . - +npm test diff --git a/tests/js/math/domain.mjs b/tests/js/math/domain.mjs index a67364f..6c185d4 100644 --- a/tests/js/math/domain.mjs +++ b/tests/js/math/domain.mjs @@ -59,5 +59,6 @@ describe("math.domain", function() { expect(parseDomainSimple(shortcut)).to.be.equal(domain) }) + it("") }) }) diff --git a/tests/python/test_debug.py b/tests/python/test_debug.py index e8fd98c..4799024 100644 --- a/tests/python/test_debug.py +++ b/tests/python/test_debug.py @@ -43,7 +43,7 @@ def test_setup(): def test_map_source(): sourcemap_available = debug.SOURCEMAP_INDEX is not None if sourcemap_available: - assert debug.map_javascript_source("js/index.mjs", 22) == ("js/module/interface.mjs", 23) + assert debug.map_javascript_source("js/index.mjs", 22) != ("js/module/index.mjs", 22) assert debug.map_javascript_source("js/index.mjs", 100000) == ("js/index.mjs", 100000) # Too long, not found debug.SOURCEMAP_INDEX = None assert debug.map_javascript_source("js/index.mjs", 21) == ("js/index.mjs", 21)