1
0
mirror of https://github.com/j178/prek.git synced 2026-04-03 17:34:03 +02:00
Files
prek/tests/languages/fail.rs
Jo 6dda4aa9f6 Do not dim the hook output (#1126)
* Do not dim the hook output

* Update snapshots
2025-11-20 19:16:55 +08:00

47 lines
1.1 KiB
Rust

use anyhow::Result;
use assert_fs::prelude::*;
use crate::common::{TestContext, cmd_snapshot};
/// GitHub Action only has docker for linux hosted runners.
#[test]
fn fail() -> Result<()> {
let context = TestContext::new();
context.init_project();
let cwd = context.work_dir();
cwd.child("changelog").create_dir_all()?;
cwd.child("changelog/changelog.md").touch()?;
context.write_pre_commit_config(indoc::indoc! {r"
repos:
- repo: local
hooks:
- id: changelogs-rst
name: changelogs must be rst
entry: changelog filenames must end in .rst
language: fail
files: 'changelog/.*(?<!\.rst)$'
"});
context.git_add(".");
cmd_snapshot!(context.filters(), context.run(), @r"
success: false
exit_code: 1
----- stdout -----
changelogs must be rst...................................................Failed
- hook id: changelogs-rst
- exit code: 1
changelog filenames must end in .rst
changelog/changelog.md
----- stderr -----
");
Ok(())
}