Automock is not working for function with generics

Why this code doesn't compile in test mode? When I do cargo check it works, but when I run cargo test, it fails to compile.

fn main() {
    println!("Hello World!");
}

#[cfg_attr(test, mockall::automock)]
trait MyTrait {
    fn get_val(&self) -> i32;
    fn process<const N: usize>(&self, vals: [i32; N]) -> [i32; N];
}

Below are the compilation error for cargo test.

error[E0425]: cannot find value `N` in this scope
 --> src/main.rs:8:51
  |
8 |     fn process<const N: usize>(&self, vals: [i32; N]) -> [i32; N];
  |                                                   ^ not found in this scope

error[E0425]: cannot find value `N` in this scope
 --> src/main.rs:8:64
  |
8 |     fn process<const N: usize>(&self, vals: [i32; N]) -> [i32; N];
  |                                                                ^ not found in this scope