override fun getRunProfileState()

in plugin-bazel/src/main/kotlin/org/jetbrains/bazel/jvm/run/JvmTestHandler.kt [40:56]


  override fun getRunProfileState(executor: Executor, environment: ExecutionEnvironment): RunProfileState {
    if (executor is DefaultDebugExecutor) {
      environment.putCopyableUserData(COROUTINE_JVM_FLAGS_KEY, Ref())
    }
    /**
     * 1. Allow the user to disable --script_path because it screws up test result caching
     * 2. Tests with coverage must be run with `bazel coverage`, because running with --script_path just runs the tests normally
     * 3. Because `bazel run` only supports one target, so does `bazel run --script_path`
     */
    return if (((!state.runWithBazel && executor is DefaultRunExecutor) || executor is DefaultDebugExecutor) && configuration.targets.size == 1) {
      environment.putCopyableUserData(SCRIPT_PATH_KEY, Ref())
      ScriptPathTestCommandLineState(environment, state)
    }
    else {
      BazelTestCommandLineState(environment, state)
    }
  }