Running tests using Pest
-
Hi, we are trying to run the test suites using Pest in a local Sail environment and they all fail.
Are we missing something?
we are using the command
sail artisan test (--env=testing)
. -
Hello @MartintheMartian
Currently, we don't support Sail Although, this issue has already been raised and is open.
Link - https://github.com/bagisto/bagisto/issues/9962
In the future, we will provide this functionality.
Thanks & Regards
-
Okay I got the tests working locally with Sail.
But now the nearly all the tests fail with a 401 instead of a 200 response in the Bitbucket pipeline, using this setup:
image: php:8.3 definitions: services: mysql: image: mysql:8.0 environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: bagisto MYSQL_USER: bagisto MYSQL_PASSWORD: password pipelines: default: - step: name: Install Dependencies caches: - composer services: - mysql script: - apt-get update && apt-get install -y unzip libzip-dev git libicu-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev - docker-php-ext-configure gd --with-freetype --with-jpeg - docker-php-ext-install gd exif intl calendar zip pdo pdo_mysql - curl -fsSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - composer install --no-interaction --prefer-dist --optimize-autoloader --dev - ls -al ./vendor/bin # List files in vendor/bin to confirm installation - cp .env.example .env - php artisan key:generate - step: name: Run Tests caches: - composer services: - mysql script: - apt-get update && apt-get install -y unzip libzip-dev git libicu-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev - docker-php-ext-configure gd --with-freetype --with-jpeg - docker-php-ext-install gd exif intl calendar zip pdo pdo_mysql - curl -fsSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - composer install --no-interaction --prefer-dist --optimize-autoloader - cp .env.example .env - php artisan key:generate - php artisan migrate - php artisan serve & - sleep 5 - php -d memory_limit=-1 artisan test - step: name: Build Artifacts script: - php artisan config:cache - php artisan route:cache artifacts: - storage/logs
-
Hello @MartintheMartian
This issue is coming might be you are not getting the logged-in user that's why 401 error is coming.
Kindly recheck it and let us know.
Thanks & Regards