gitlab-ci-local icon indicating copy to clipboard operation
gitlab-ci-local copied to clipboard

RegEx syntax in getCoveragePercent

Open Winand opened this issue 7 months ago • 0 comments

I have exactly the same issue as described in a comment in #932:

SyntaxError: Invalid regular expression: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/gm: Invalid group
    at new RegExp (<anonymous>)
    at Function.getCoveragePercent (C:\snapshot\firecow-gitlab-ci-local\src\utils.ts:84:23)
    at async er.start (C:\snapshot\firecow-gitlab-ci-local\src\job.ts:687:37)
    at async <anonymous> (C:\snapshot\firecow-gitlab-ci-local\node_modules\p-map\index.js:57:22)

Minimal .gitlab-ci.yml illustrating the issue

run_tests:
    stage: test
    rules:
      - if: $CI_COMMIT_BRANCH == "develop" || $CI_COMMIT_BRANCH == "master"
    image: python:3.12
    # https://docs.gitlab.com/ee/ci/testing/unit_test_reports.html#how-to-set-it-up
    artifacts:
      when: always
      reports:
        junit: junit_report.xml
        coverage_report:
          coverage_format: cobertura
          path: coverage.xml
    before_script:
        - pip install --retries 10 --timeout 30 uv==${VERSION_UV}
        - uv sync
    script:
        # Coverage https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html#python-example
        - uv run pytest -v --junitxml=junit_report.xml
                        --cov --cov-report term --cov-report xml:coverage.xml
    # Coverage https://docs.gitlab.com/ee/ci/yaml/index.html#coverage
    coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'

I think this is related: gitlab-org/gitlab#362234

Host information Windows 10 gitlab-ci-local 4.60.1

Winand avatar May 29 '25 09:05 Winand