pestphp / docs

The official documentation for Pest.
https://pestphp.com/docs
MIT License
50 stars 132 forks source link

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

Open bluesheep100 opened 1 month ago

bluesheep100 commented 1 month ago

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.

JHWelch commented 1 month ago

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);
        }
    }
bluesheep100 commented 1 month ago

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?