I fixed it. I had to manually add the junit platform launcher dependency:
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.12.2'
Thanks for everyone's help.