Different test results of @test_opt inside and outside the @testitem block

I found that when the function contains @warn, the testing results of @test_opt inside the @testitem block differ from those outside, i.e. in the REPL. Please see the code below.

Could someone explain why this happens and how to resolve this difference? Thanks for your time.

## put following codes to package module file
function wuyu(x)
     x > 1 && @warn "this is a warning."
     return x
end
@testitem "jet test opt" begin
    using JET
    @test_opt wuyu(2)    # Test fail
end
# run following codes directly in the REPL
using JET
@test_opt wuyu(2)    # Test pass