diff --git a/roles/tests/tests_behat/defaults/main.yml b/roles/tests/tests_behat/defaults/main.yml index 1962957f..7504ea2b 100644 --- a/roles/tests/tests_behat/defaults/main.yml +++ b/roles/tests/tests_behat/defaults/main.yml @@ -3,6 +3,7 @@ behat: install: false # set to true if you want ce-deploy to attempt to composer install Behat tags: "~@javascript" # behat tags to run verbose: false # set to true for verbose output + fail_builds: true # set to false if you do not want Ansible to stop if Behat tests fail bin: "{{ deploy_path }}/vendor/bin/behat" # location of Behat # List of outputs to create, defaults to 'pretty' to STDOUT outputs: diff --git a/roles/tests/tests_behat/tasks/main.yml b/roles/tests/tests_behat/tasks/main.yml index ae11605d..212a3a88 100644 --- a/roles/tests/tests_behat/tasks/main.yml +++ b/roles/tests/tests_behat/tasks/main.yml @@ -26,4 +26,16 @@ - name: Run Behat command. ansible.builtin.command: cmd: "{{ behat.bin }} --config={{ behat.config_file }} --tags={{ behat.tags }} {{ _behat_outputs }}" - when: behat.outputs | length > 0 + chdir: "{{ behat.working_dir }}" + when: + - behat.outputs | length > 0 + - behat.fail_builds + +- name: Run Behat command without failing build. + ansible.builtin.command: + cmd: "{{ behat.bin }} --config={{ behat.config_file }} --tags={{ behat.tags }} {{ _behat_outputs }}" + chdir: "{{ behat.working_dir }}" + failed_when: false + when: + - behat.outputs | length > 0 + - not behat.fail_builds