Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option --coverage is ambiguous #94

Closed
faustbrian opened this issue Jun 15, 2020 · 9 comments
Closed

option --coverage is ambiguous #94

faustbrian opened this issue Jun 15, 2020 · 9 comments

Comments

@faustbrian
Copy link
Contributor

When running pest on CI there is an odd error that I run into with the --coverage flag.

> ./vendor/bin/pest --coverage --min=100
PHPUnit 9.2.2 by Sebastian Bergmann and contributors.

option --coverage is ambiguous
Script ./vendor/bin/pest --coverage --min=100 handling the test event returned with error code 1

##[error]Process completed with exit code 1.

This only happens with a GitHub workflow and I am unable to reproduce this locally. Could the binaries of pest and phpunit somehow end up being linked faulty?

@nunomaduro
Copy link
Member

@owenvoke any idea?

@nunomaduro
Copy link
Member

Can you share your GitHub actions file?

@faustbrian
Copy link
Contributor Author

name: Test

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:12
        env:
          POSTGRES_DB: homestead
          POSTGRES_USER: homestead
          POSTGRES_PASSWORD: password
        ports:
          - 5432:5432
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: "7.4"
          extensions: mbstring, dom, fileinfo, intl, gd, imagick, bcmath, soap, zip, sqlite, pcov
          coverage: pcov

      - name: Cache dependencies
        uses: actions/cache@v2
        with:
          path: ~/.composer/cache/files
          key: dependencies-composer-${{ hashFiles('composer.json') }}

      - name: Authenticate Nova
        run: composer config http-basic.nova.laravel.com ${{ secrets.NOVA_USERNAME }} ${{ secrets.NOVA_PASSWORD }}

      - name: Install Composer dependencies
        run: composer install --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist --optimize-autoloader

      - name: Prepare the application
        run: cp .env.example .env && php artisan key:generate

      - name: Clear Config
        run: php artisan config:clear && php artisan route:clear

      - name: Run Tests
        run: ./vendor/bin/pest --coverage --min=100

      - name: Codecov
        run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}

@faustbrian
Copy link
Contributor Author

If it is of any help. I just tried to upgrade another application from 0.1.0 to 0.2.0 and that is when the issue with the ambiguous flag starts.

@nunomaduro
Copy link
Member

Remove the --no-scripts from the composer install.

@mreduar
Copy link

mreduar commented Feb 8, 2024

Any idea what could be happening? I don't have --no-scripts and I use bitbucket
image

@paulshryock
Copy link

paulshryock commented Feb 9, 2024

I also started seeing this error today on Bitbucket, with no change in my continuous integration pipeline. Just started getting the PHPUnit error when Pest runs. I wonder if Bitbucket made a change so that composer install is run with lower permissions, and --no-scripts is automatically applied.

@paulshryock
Copy link

paulshryock commented Feb 9, 2024

In my setup, I was programmatically using the "latest" version of Composer. Yesterday, Composer 2.7.0 was released, and that caused composer install to be run automatically with --no-plugins and --no-scripts in Bitbucket pipelines.

Temporarily, we got around this by pinning to Composer 2.6.6, and our pipelines are passing again. Ultimately we'll likely just add COMPOSER_ALLOW_SUPERUSER=1 to our composer install line, and then we can go back to using the latest Composer version.

@mreduar
Copy link

mreduar commented Feb 12, 2024

In my setup, I was programmatically using the "latest" version of Composer. Yesterday, Composer 2.7.0 was released, and that caused composer install to be run automatically with --no-plugins and --no-scripts in Bitbucket pipelines.

Temporarily, we got around this by pinning to Composer 2.6.6, and our pipelines are passing again. Ultimately we'll likely just add COMPOSER_ALLOW_SUPERUSER=1 to our composer install line, and then we can go back to using the latest Composer version.

Thanks for sharing @paulshryock, this solved the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants