Jump24——Laravel 开发人员,精准到位。绝不外包。绝不离岸外包。始终卓越。

Flaky Test Retries in Pest v4.5.0

最后更新于 经过

Flaky Test Retries in Pest v4.5.0 image

Pest v4.5.0 adds first-class support for retrying flaky tests with a new flaky() modifier and --flaky CLI flag. The release also includes a new architecture assertion for detecting namespace/file path casing mismatches, a --only-covered coverage filter, and more.

  • flaky() test modifier with configurable retry count
  • --flaky CLI option to run only flaky-marked tests
  • toBeCasedCorrectly architecture assertion
  • --only-covered option for code coverage output
  • Multiple bug fixes for datasets, traits, and parallel testing

什么是新的

flaky() Test Modifier and --flaky CLI Option

Tests that fail intermittently due to timing, external dependencies, or other non-deterministic conditions can now be marked with ->flaky() . When a flaky test fails, Pest automatically retries it up to the configured number of times before reporting it as a failure. The default retry count is 3.

'sends an email notification' , 功能 (){
// ...
}) -> flaky ();
'resolves within the timeout' , 功能 (){
// ...
}) -> flaky 尝试 : 5 (英文):

新的 --flaky CLI flag filters the test run to execute only tests marked as flaky, making it easier to verify or debug unstable tests in isolation:

vendor/bin/pest --flaky

Lifecycle hooks such as beforeEachafterEach run between each retry, so test state is properly reset on every attempt.

toBeCasedCorrectly Architecture Assertion

新的 ->toBeCasedCorrectly() assertion has been added to Pest's architecture testing suite. It compares each class's namespace against its file path and flags any casing discrepancies. Because macOS and Windows use case-insensitive file systems by default, mismatched casing is often invisible in local development but causes class-not-found errors when deployed to Linux servers.

()
-> 预计 '应用程序'
-> toBeCasedCorrectly ();

A class at app/Providers/AppServiceProvider.php with the namespace App\providers\AppServiceProvider would be caught by this assertion.

公关稿: #1455 , contributed by @SimonBroekaert

--only-covered Coverage Option

--coverage flag now accepts an --only-covered companion option that hides all files with 0% coverage from the output. This is useful when working on large applications where you want to focus on which files your new tests actually cover, without scrolling past a long list of uncovered files.

vendor/bin/pest --覆盖率 --only-covered

The option does not affect --min 或者 --exact thresholds; those calculations still include all files.

公关稿: #1626 , contributed by @SimonBroekaert

问题修复

  • 固定的 toUseTrait to detect traits inherited through parent classes and nested trait usage ( #1515 ), contributed by @yondifon
  • Fixed missing classes before toExtend in the Laravel preset ( #1569 ), contributed by @treyssatvincent
  • Added "Rules" classes to the Laravel preset ( #1580 ), contributed by @bibrokhim
  • 固定的 --parallel--teamcity argument handling for ParaTest ( #1615 ), contributed by @smirok
  • Fixed nested dataset discovery and invalid-dataset reporting in parallel mode ( #1655 ), contributed by @stsepelin
  • Fixed Unicode character preservation in filenames when using --filter#1624 ), contributed by @Vmadmax
  • Fixed dataset named parameters ( #1634 ), contributed by @dbpolito
  • 固定的 this type annotations for parameter closures in functions ( #1628 ), contributed by @DevDavido
  • Fixed dataset inheritance when using method chaining with beforeEach()->with()describe()->with()#1565 ), contributed by @louisbels

参考

保罗·雷德蒙德照片

Laravel News 特约撰稿人。全栈 Web 开发人员兼作家。

归档于:
立方体

Laravel 时事通讯

加入超过 4 万名开发者的行列,不错过任何新的技巧、教程等内容。

图像
SerpApi

适用于您的 LLM 和 AI 应用的 Web 搜索 API

访问 SerpApi
Tinkerwell 徽标

廷克威尔

Laravel 开发者必备的代码运行器。可在本地和生产环境中体验 AI、自动补全和即时反馈功能。

廷克威尔
几天内即可获得 Laravel 代码审查徽标的专家指导

几天内即可获得 Laravel 代码审查方面的专家指导

专家级代码审查!两位拥有 10 年以上 Laravel 开发经验的开发者将为您提供清晰、实用的反馈,帮助团队构建更优质的应用程序。

几天内即可获得 Laravel 代码审查方面的专家指导
PhpStorm 标志

PhpStorm

首选的 PHP IDE,对 Laravel 及其生态系统提供广泛的开箱即用支持。

PhpStorm
Laravel Cloud 标志

Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

Laravel 云
了解 Softtech 的标志

了解软科技

Acquaint Softtech 提供 AI 就绪的 Laravel 开发人员,48 小时内即可上手,每月费用为 3000 美元,没有冗长的销售流程,并提供 100% 退款保证。

了解软科技
Kirschbaum 标志

樱桃树

提供创新和稳定性,确保您的Web应用程序取得成功。

樱桃树
Shift 标志

转移

还在运行旧版本的 Laravel?立即实现 Laravel 自动升级和代码现代化,让您的应用程序保持最新状态。

转移
鱼叉:新一代时间跟踪和发票标志

Harpoon:新一代时间跟踪和发票系统

新一代时间跟踪和计费软件,帮助您的机构规划和预测盈利的未来。

Harpoon:新一代时间跟踪和发票系统
Lucky Media 标志

幸运传媒

Get Lucky Now——拥有十余年经验的 Laravel 开发理想之选!

幸运传媒
SaaSykit:Laravel SaaS 入门套件徽标

SaaSykit:Laravel SaaS 入门套件

SaaSykit 是一个多租户 Laravel SaaS 入门套件,包含运行现代 SaaS 所需的所有功能,例如支付、美观的结账界面、管理面板、用户仪表盘、身份验证、现成组件、统计数据、博客、文档等等。

SaaSykit:Laravel SaaS 入门套件
MongoDB 徽标

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB
Attach PDFs Directly to Mailables in laravel-pdf 2.6.0 image

Attach PDFs Directly to Mailables in laravel-pdf 2.6.0

阅读文章
Composer 2.9.6 Fixes Two Perforce Command Injection Vulnerabilities image

Composer 2.9.6 Fixes Two Perforce Command Injection Vulnerabilities

阅读文章
Ship AI with Laravel: Your AI Agent Has Amnesia. Let's Fix It. image

Ship AI with Laravel: Your AI Agent Has Amnesia. Let's Fix It.

阅读文章
Redis Cluster Support for Queues in Laravel 13.5.0 image

Redis Cluster Support for Queues in Laravel 13.5.0

阅读文章
Time-Based Sharding in Pest v4.6.0 image

Time-Based Sharding in Pest v4.6.0

阅读文章
Flaky Test Retries in Pest v4.5.0 image

Flaky Test Retries in Pest v4.5.0

阅读文章