Returns `true` if the command looks like a test invocation.
(cmd: &str)
| 248 | |
| 249 | /// Returns `true` if the command looks like a test invocation. |
| 250 | fn is_test_command(cmd: &str) -> bool { |
| 251 | let lower = cmd.to_lowercase(); |
| 252 | let patterns = [ |
| 253 | // Rust |
| 254 | "cargo test", |
| 255 | "cargo nextest", |
| 256 | // JavaScript / TypeScript |
| 257 | "npm test", |
| 258 | "npm run test", |
| 259 | "npx jest", |
| 260 | "npx vitest", |
| 261 | "npx mocha", |
| 262 | "bun test", |
| 263 | "yarn test", |
| 264 | "pnpm test", |
| 265 | "jest", |
| 266 | "vitest", |
| 267 | "mocha", |
| 268 | // Python |
| 269 | "pytest", |
| 270 | "python -m pytest", |
| 271 | "python -m unittest", |
| 272 | "python -m doctest", |
| 273 | // Go |
| 274 | "go test", |
| 275 | // Ruby |
| 276 | "rspec", |
| 277 | "rake test", |
| 278 | "bundle exec rspec", |
| 279 | // PHP |
| 280 | "phpunit", |
| 281 | "vendor/bin/phpunit", |
| 282 | // Elixir |
| 283 | "mix test", |
| 284 | // .NET |
| 285 | "dotnet test", |
| 286 | ]; |
| 287 | patterns.iter().any(|p| lower.contains(p)) |
| 288 | } |
| 289 | |
| 290 | /// Returns `true` if the command looks like a lint invocation. |
| 291 | fn is_lint_command(cmd: &str) -> bool { |
no test coverage detected