Pest: option --coverage is ambiguous

Created on 15 Jun 2020  路  5Comments  路  Source: pestphp/pest

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?

Most helpful comment

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

All 5 comments

@owenvoke any idea?

Can you share your GitHub actions file?

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 }}

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexMartinFR picture AlexMartinFR  路  7Comments

beliolfa picture beliolfa  路  3Comments

dingo-d picture dingo-d  路  6Comments

maks-rafalko picture maks-rafalko  路  6Comments

albertpratomo picture albertpratomo  路  7Comments