docs icon indicating copy to clipboard operation
docs copied to clipboard

pest --ci option doesn't exist and no-ops?

Open bluesheep100 opened this issue 1 year ago • 3 comments

I was going to set up CI/CD with Pest to help enforce keeping expectations up to date. However, the guide is rather confusing, as I can't find out what ./vendor/bin/pest --ci would do differently to just ./vendor/bin/pest, due to there seemingly being no mention of what this --ci option does anywhere. Maybe I'm just blind, but I really can't find it, and running the command with --ci doesn't make any visible difference in output.

bluesheep100 avatar Sep 18 '24 11:09 bluesheep100

From a quick search in the codebase, it only seems to set the Environment::name() to a CI constant.

And then that is only used in whether it creates a lockfile

    /**
     * Creates the lock file.
     */
    public static function enable(TestCall $testCall, string $group = '__pest_only'): void
    {
        $testCall->group($group);

        if (Environment::name() === Environment::CI || Parallel::isWorker()) {
            return;
        }

        $lockFile = self::TEMPORARY_FOLDER.DIRECTORY_SEPARATOR.'only.lock';

        if (file_exists($lockFile) && $group === '__pest_only') {
            file_put_contents($lockFile, $group);

            return;
        }

        if (! file_exists($lockFile)) {
            touch($lockFile);

            file_put_contents($lockFile, $group);
        }
    }

JHWelch avatar Sep 18 '24 18:09 JHWelch

Well, I guess that's a reason to use the flag, though I'm not sure what a lockfile does in the context of a testing framework. I only know composer.lock and such. Is it just to prevent mid-runtime configuration changes or something?

bluesheep100 avatar Sep 20 '24 06:09 bluesheep100

Pest v4 adds more to the --ci flag since now you can tag tests that only run in CI or are skipped in CI.

Jamesking56 avatar Aug 13 '25 15:08 Jamesking56