Skip to content

Fix incomplete and repetitive Composer scripts across monorepo #46

@coderabbitai

Description

@coderabbitai

Overview

Several composer.json files across the monorepo contain Composer script definitions that are either unsupported syntax or produce incomplete results. These are non-blocking today but should be fixed for developer ergonomics and accurate coverage reporting.

Reported via PR #45 comment: #45 (comment)

Requested by: @juliolmuller


Problem 1 — @script extra-args is not supported by Composer

Composer does not support passing additional CLI arguments to a @script-name reference (e.g. "test:cov": "@test --coverage-html coverage"). The extra flags are silently ignored or cause unexpected behaviour.

Affected files:

  • packages/cpf-dv/composer.json: "test:watch": "@test --watch" and "test:cov": "@test --coverage-html coverage"
  • packages/cnpj-dv/composer.json: "test:watch": "@test --watch" and "test:cov": "@test --coverage-html coverage"
  • packages/cnpj-fmt/composer.json: "test:watch": "@test --watch" and "test:cov": "@test --coverage-html coverage"

Each of these should be rewritten as self-contained commands (e.g. pest --configuration=.pest.config.xml --coverage-html coverage).


Problem 2 — test:cov missing coverage flag on isolated-process run

For packages whose test script is split into two Pest invocations (one for --group isolated-process-tests and one for the rest), only the second invocation in test:cov includes --coverage-html coverage. The isolated-process run is excluded, underreporting package coverage.

Affected files:

  • packages/cnpj-utils/composer.json
  • packages/cnpj-gen/composer.json
  • packages/cnpj-val/composer.json

The first Pest call in each test:cov array should also include the coverage flag.


Problem 3 — Legacy PHPUnit-style scripts still in use

Several packages have not yet migrated to Pest and still reference phpunit-watcher which is no longer a dependency in most packages:

  • packages/cpf-utils/composer.json
  • packages/cpf-gen/composer.json
  • packages/cpf-val/composer.json
  • packages/cpf-fmt/composer.json
  • packages/utils/composer.json
  • packages/br-utils/composer.json

These packages should be evaluated for Pest migration or at minimum have their test:watch / test-coverage scripts corrected.


Acceptance Criteria

  • All @script extra-args patterns replaced with self-contained commands
  • All test:cov scripts produce coverage for both isolated-process and regular test runs
  • Legacy phpunit-watcher references removed or replaced
  • All affected composer test and composer test:cov scripts verified to run successfully

Metadata

Metadata

Assignees

Labels

bugSomething wrong isn't right.enhancementNew minor or major features.

Type

No fields configured for Task.

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions