import * as tracing_1 from "../../Tracing"
const fileName_1 = "(@effect-ts/system): _src/Testing/TestRunner/index.ts"
import * as Clock from "../../Clock"
import * as T from "../../Effect"
import { pipe } from "../../Function"
import * as L from "../../Layer"
import * as Annotations from "../Annotations"
import * as TestAnnotationRenderer from "../TestAnnotationRenderer"
import { Duration } from "../TestClock"
import { defaultExecutor } from "../TestExecutor"
import { FromConsole } from "../TestLogger"
import { DefaultTestReporter } from "../TestReporter"
const defaultClock = /*#__PURE__*/ L.fromFunction(Clock.HasClock)(
  () => new Clock.LiveClock()
)
const defaultLayer = /*#__PURE__*/ defaultClock["+++"](FromConsole)
export class TestRunner {
  constructor(
    executor,
    platform = T.defaultPlatform,
    reporter = DefaultTestReporter(TestAnnotationRenderer.standard),
    bootstrap = defaultLayer
  ) {
    this.executor = executor
    this.platform = platform
    this.reporter = reporter
    this.bootstrap = bootstrap
    this.runtime = new T.CustomRuntime(undefined, this.platform)

    this.run = (spec) =>
      T.chain_(
        T.timed(this.executor.run(spec, T.parallelN(4)), fileName_1 + ":38:14"),
        ({ tuple: [d, e] }) =>
          T.as_(this.reporter(Duration(d), e), e, fileName_1 + ":39:43"),
        fileName_1 + ":39:14"
      )
  }
}
export const defaultTestRunner = /*#__PURE__*/ new TestRunner(
  /*#__PURE__*/ defaultExecutor(
    /*#__PURE__*/ Annotations.live["+++"](/*#__PURE__*/ L.succeed(T.defaultEnv))
  )
)
//# sourceMappingURL=index.js.map
