fetzi/phpspec-watcher

phpspec-watcher 是一个用于在代码更改时自动执行 phpspec 测试的命令行工具

2.0.1 2020-04-13 15:20 UTC

This package is auto-updated.

Last update: 2024-09-14 00:27:10 UTC


README

Packagist Github Actions StyleCI SensioLabs Insight Maintainability

介绍

phpspec-watcher 是一个自动化 phpspec 测试执行的工具,当项目源代码发生变化时。在文件保存时,监视器会自动触发 phpspec 测试套件,并向开发者报告测试结果。

安装

可以使用以下命令全局安装此工具:

composer global require fetzi/phpspec-watcher

或者仅作为某个包的开发依赖项安装

composer require fetzi/phpspec-watcher --dev

用法

全局安装后,可以通过以下命令调用监视器:

phpspec-watcher watch

如果您将监视器作为某个项目开发依赖项安装,您可以在 vendor/bin 目录中找到二进制文件。

vendor/bin/phpspec-watcher watch

配置

监视器可以通过存储在项目根目录中的配置文件 .phpspec-watcher.yml 进行配置。

以下列表显示了文件结构和选项含义

fileMask: '*.php'                   # file pattern that should be watched

checkInterval: 1                    # a float value indicating the resource check interval

directories:                        # a list of directories that should be watched
    - app
    - src
    - spec

phpspec:
    binary: vendor/bin/phpspec      # path to the phpspec binary
    arguments: [format=dot]         # additional phpspec arguments

notifications:                      # flags for notfications on success and on error
    onError: true
    onSuccess: true

为了加快配置过程,有一个初始化命令,用于使用默认值启动配置文件

phpspec-watcher init

通知

监视器在执行测试套件后触发操作系统通知。

要在 Mac 上显示通知图标,您需要安装另一个通知器,因为 AppleScript 无法显示自定义图标

brew install terminal-notifier

鸣谢

创建此包的想法是在发现 Spatie 的 phpunit-watcher 包后产生的。

许可证

MIT 许可证(MIT)。请参阅 许可证文件 了解更多信息。