moodlehq/moodle-plugin-ci

PHPUNIT_IGNORE_PATHS does not work.

manojmalik20 opened this issue · 7 comments

Hello!

I am using moodle-plugin-ci in a Moodle plugin and want to ignore some PHPUnit tests from running in the CI. I tried using IGNORE_PATHS, PHPUNIT_IGNORE_PATHS, IGNORE_NAMES, PHPUNIT_IGNORE_NAMES but nothing seems to work. I even tried to use these variables in the env for only phpunit command instead of defining them while installing moodle-plugin-ci but that didn't work also. I am using Github actions and here are some examples I tried in my yml file.

- name: Install moodle-plugin-ci
        run: |
          moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
        env:
          DB: ${{ matrix.database }}
          MOODLE_BRANCH: ${{ matrix.moodle-branch }}
          PHPUNIT_IGNORE_PATHS: tests/integration
- name: PHPUnit tests
        if: ${{ always() }}
        run: moodle-plugin-ci phpunit
        env:
          PHPUNIT_IGNORE_PATHS: tests/integration
          IGNORE_PATHS: tests/integration

I've tried several paths too like

./moodle/mod/{module_name}/tests/integration/*.php
moodle/mod/{module_name}/tests/integration
plugin/tests/integration

But nothing seems to work.
I would really appreciate some help on this.

Thanks,

Manoj

Hi @manojmalik20, you need to define IGNORE_* at installing step, they don't have effect at actual test running step. Did you try quoting the path?

    PHPUNIT_IGNORE_PATHS: 'tests/integration'

Hi @manojmalik20, you need to define IGNORE_* at installing step, they don't have effect at actual test running step. Did you try quoting the path?

Defining the variables at installing step didn't work either and I tried quoting the path also, still didn't work.

Can you share the link to the CI report where you tested this ignore param?

Right now, the repo is private and we are planning to make it public in a few days. I can share the link with you after that.

@kabalin Did you get a chance to look at the link?

Hi @manojmalik20, yeah, phpunit does not respect *_IGNORE_PATHS at all at the moment. As workaround you need either custom phpunit.xml that would filter directory you need to exclude or run vendor/bin/phpunit directly as separate step (with --filter param to fetch only testcases you need).