Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 18 additions & 76 deletions packages/builder/api/builder.api
Original file line number Diff line number Diff line change
Expand Up @@ -2661,117 +2661,59 @@ public abstract class elide/tooling/runner/AbstractTestRunner : elide/tooling/ru
public synthetic fun <init> (Lelide/tooling/runner/TestRunner$Config;Ljava/util/concurrent/Executor;Lelide/tooling/config/TestConfigurator$TestEventController;Lkotlin/jvm/functions/Function0;Lkotlin/time/TimeSource;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun awaitSettled (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun close ()V
protected final fun fail (Ljava/lang/Throwable;)Lelide/runtime/intrinsics/testing/TestResult;
public static synthetic fun fail$default (Lelide/tooling/runner/AbstractTestRunner;Ljava/lang/Throwable;ILjava/lang/Object;)Lelide/runtime/intrinsics/testing/TestResult;
protected final fun fail (Ljava/lang/Throwable;)Lelide/tooling/testing/TestResult;
public static synthetic fun fail$default (Lelide/tooling/runner/AbstractTestRunner;Ljava/lang/Throwable;ILjava/lang/Object;)Lelide/tooling/testing/TestResult;
public fun getConfig ()Lelide/tooling/runner/TestRunner$Config;
protected final fun getContextProvider ()Lkotlin/jvm/functions/Function0;
public fun getEvents ()Lelide/tooling/config/TestConfigurator$TestEventController;
public fun getExecutor ()Ljava/util/concurrent/Executor;
protected final fun pass ()Lelide/runtime/intrinsics/testing/TestResult;
protected final fun pass ()Lelide/tooling/testing/TestResult;
protected fun resolve (Lelide/runtime/core/PolyglotContext;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;)Lelide/runtime/intrinsics/testing/TestEntrypoint;
protected abstract fun runTest (Lkotlinx/coroutines/CoroutineScope;Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;)Lkotlinx/coroutines/Deferred;
protected fun runnable (Lelide/runtime/core/PolyglotContext;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;)Lelide/runtime/intrinsics/testing/Reason;
protected final fun skip (Lelide/runtime/intrinsics/testing/Reason;)Lelide/runtime/intrinsics/testing/TestResult;
protected fun runnable (Lelide/runtime/core/PolyglotContext;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;)Lelide/tooling/testing/Reason;
protected final fun skip (Lelide/tooling/testing/Reason;)Lelide/tooling/testing/TestResult;
protected final fun testExec (Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;)V
protected final fun testFailed (Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;Ljava/lang/Throwable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
protected final fun testSeen (Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;)V
protected final fun testSkipped (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/Reason;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
protected final fun testSkipped (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/tooling/testing/Reason;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
protected final fun testSucceeded (Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun tests (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/coroutines/flow/Flow;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public final class elide/tooling/runner/AbstractTestRunner$TestCaseResult : java/lang/Record {
public synthetic fun <init> (Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestResult;JLkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun case ()Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;
public final fun component1 ()Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;
public final fun component2 ()Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;
public final fun component3 ()Lelide/runtime/intrinsics/testing/TestResult;
public final fun component4-UwyO8pc ()J
public final fun copy-Wn2Vu4Y (Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestResult;J)Lelide/tooling/runner/AbstractTestRunner$TestCaseResult;
public static synthetic fun copy-Wn2Vu4Y$default (Lelide/tooling/runner/AbstractTestRunner$TestCaseResult;Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestResult;JILjava/lang/Object;)Lelide/tooling/runner/AbstractTestRunner$TestCaseResult;
public final fun duration ()J
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public final fun result ()Lelide/runtime/intrinsics/testing/TestResult;
public final fun scope ()Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;
public fun toString ()Ljava/lang/String;
}

protected final class elide/tooling/runner/AbstractTestRunner$TestExecutionResult : java/lang/Record {
public synthetic fun <init> (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;Lelide/runtime/intrinsics/testing/TestResult;JLkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun <init> (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/tooling/testing/TestScope;Lelide/tooling/testing/TestResult;JLkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;
public final fun component2 ()Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;
public final fun component3 ()Lelide/runtime/intrinsics/testing/TestResult;
public final fun component2 ()Lelide/tooling/testing/TestScope;
public final fun component3 ()Lelide/tooling/testing/TestResult;
public final fun component4-UwyO8pc ()J
public final fun copy-Wn2Vu4Y (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;Lelide/runtime/intrinsics/testing/TestResult;J)Lelide/tooling/runner/AbstractTestRunner$TestExecutionResult;
public static synthetic fun copy-Wn2Vu4Y$default (Lelide/tooling/runner/AbstractTestRunner$TestExecutionResult;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;Lelide/runtime/intrinsics/testing/TestResult;JILjava/lang/Object;)Lelide/tooling/runner/AbstractTestRunner$TestExecutionResult;
public final fun copy-Wn2Vu4Y (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/tooling/testing/TestScope;Lelide/tooling/testing/TestResult;J)Lelide/tooling/runner/AbstractTestRunner$TestExecutionResult;
public static synthetic fun copy-Wn2Vu4Y$default (Lelide/tooling/runner/AbstractTestRunner$TestExecutionResult;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/tooling/testing/TestScope;Lelide/tooling/testing/TestResult;JILjava/lang/Object;)Lelide/tooling/runner/AbstractTestRunner$TestExecutionResult;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public final fun result ()Lelide/runtime/intrinsics/testing/TestResult;
public final fun scope ()Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;
public final fun result ()Lelide/tooling/testing/TestResult;
public final fun scope ()Lelide/tooling/testing/TestScope;
public final fun test ()Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;
public final fun timing ()J
public fun toString ()Ljava/lang/String;
}

protected final class elide/tooling/runner/AbstractTestRunner$TestRunRequest : java/lang/Record {
public fun <init> (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestEntrypoint;Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;Lelide/runtime/core/PolyglotContext;)V
public fun <init> (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestEntrypoint;Lelide/tooling/testing/TestScope;Lelide/runtime/core/PolyglotContext;)V
public final fun component1 ()Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;
public final fun component2 ()Lelide/runtime/intrinsics/testing/TestEntrypoint;
public final fun component3 ()Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;
public final fun component3 ()Lelide/tooling/testing/TestScope;
public final fun component4 ()Lelide/runtime/core/PolyglotContext;
public final fun context ()Lelide/runtime/core/PolyglotContext;
public final fun copy (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestEntrypoint;Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;Lelide/runtime/core/PolyglotContext;)Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;
public static synthetic fun copy$default (Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestEntrypoint;Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;Lelide/runtime/core/PolyglotContext;ILjava/lang/Object;)Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;
public final fun copy (Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestEntrypoint;Lelide/tooling/testing/TestScope;Lelide/runtime/core/PolyglotContext;)Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;
public static synthetic fun copy$default (Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;Lelide/runtime/intrinsics/testing/TestEntrypoint;Lelide/tooling/testing/TestScope;Lelide/runtime/core/PolyglotContext;ILjava/lang/Object;)Lelide/tooling/runner/AbstractTestRunner$TestRunRequest;
public final fun entry ()Lelide/runtime/intrinsics/testing/TestEntrypoint;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public final fun scope ()Lelide/runtime/intrinsics/testing/TestingRegistrar$TestScope;
public final fun scope ()Lelide/tooling/testing/TestScope;
public final fun test ()Lelide/runtime/intrinsics/testing/TestingRegistrar$RegisteredTest;
public fun toString ()Ljava/lang/String;
}

public final class elide/tooling/runner/AbstractTestRunner$TestRunResult : java/lang/Record {
public synthetic fun <init> (Lelide/runtime/intrinsics/testing/TestResult;ILelide/tooling/runner/AbstractTestRunner$TestStats;Ljava/util/List;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public synthetic fun <init> (Lelide/runtime/intrinsics/testing/TestResult;ILelide/tooling/runner/AbstractTestRunner$TestStats;Ljava/util/List;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Lelide/runtime/intrinsics/testing/TestResult;
public final fun component2-pVg5ArA ()I
public final fun component3 ()Lelide/tooling/runner/AbstractTestRunner$TestStats;
public final fun component4 ()Ljava/util/List;
public final fun component5 ()Z
public final fun copy-roUYKiI (Lelide/runtime/intrinsics/testing/TestResult;ILelide/tooling/runner/AbstractTestRunner$TestStats;Ljava/util/List;Z)Lelide/tooling/runner/AbstractTestRunner$TestRunResult;
public static synthetic fun copy-roUYKiI$default (Lelide/tooling/runner/AbstractTestRunner$TestRunResult;Lelide/runtime/intrinsics/testing/TestResult;ILelide/tooling/runner/AbstractTestRunner$TestStats;Ljava/util/List;ZILjava/lang/Object;)Lelide/tooling/runner/AbstractTestRunner$TestRunResult;
public final fun earlyExit ()Z
public fun equals (Ljava/lang/Object;)Z
public final fun exitCode ()I
public fun hashCode ()I
public final fun result ()Lelide/runtime/intrinsics/testing/TestResult;
public final fun results ()Ljava/util/List;
public final fun stats ()Lelide/tooling/runner/AbstractTestRunner$TestStats;
public fun toString ()Ljava/lang/String;
}

public final class elide/tooling/runner/AbstractTestRunner$TestStats : java/lang/Record {
public synthetic fun <init> (IIIIIJLkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1-pVg5ArA ()I
public final fun component2-pVg5ArA ()I
public final fun component3-pVg5ArA ()I
public final fun component4-pVg5ArA ()I
public final fun component5-pVg5ArA ()I
public final fun component6-UwyO8pc ()J
public final fun copy-NqIEkfQ (IIIIIJ)Lelide/tooling/runner/AbstractTestRunner$TestStats;
public static synthetic fun copy-NqIEkfQ$default (Lelide/tooling/runner/AbstractTestRunner$TestStats;IIIIIJILjava/lang/Object;)Lelide/tooling/runner/AbstractTestRunner$TestStats;
public final fun duration ()J
public fun equals (Ljava/lang/Object;)Z
public final fun executions ()I
public final fun fails ()I
public fun hashCode ()I
public final fun passes ()I
public final fun skips ()I
public final fun tests ()I
public fun toString ()Ljava/lang/String;
}

public final class elide/tooling/runner/ProcessRunner {
public static final field INSTANCE Lelide/tooling/runner/ProcessRunner;
public static final fun build (Ljava/nio/file/Path;Lkotlin/jvm/functions/Function1;)Lelide/tooling/runner/ProcessRunner$ProcessTaskBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import elide.tooling.registry.ResolverRegistry
* }
* }
* ```
*
*/
public object TestDriver {
@JvmStatic
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2024-2025 Elide Technologies, Inc.
*
* Licensed under the MIT license (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://opensource.org/license/mit/
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under the License.
*/
package elide.tooling.coverage

import elide.tooling.Tool
import elide.tooling.testing.TestPostProcessingOptions
import elide.tooling.testing.TestPostProcessor
import elide.tooling.testing.TestPostProcessorFactory
import elide.tooling.testing.TestRunResult

// Implements coverage reporting steps which take place after tests have run.
internal class CoverageReportProcessor : TestPostProcessor {
override suspend fun invoke(options: TestPostProcessingOptions, results: TestRunResult): Tool.Result {
// @TODO coverage report processor is not implemented yet
return Tool.Result.Success
}

// Create a coverage report processor if coverage is enabled.
class Factory : TestPostProcessorFactory<CoverageReportProcessor> {
override fun create(options: TestPostProcessingOptions): TestPostProcessor? = when (options.coverageEnabled) {
false -> null
else -> CoverageReportProcessor()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2024-2025 Elide Technologies, Inc.
*
* Licensed under the MIT license (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://opensource.org/license/mit/
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under the License.
*/
package elide.tooling.reporting

import elide.tooling.Tool
import elide.tooling.testing.TestPostProcessingOptions
import elide.tooling.testing.TestPostProcessor
import elide.tooling.testing.TestPostProcessorFactory
import elide.tooling.testing.TestRunResult

// Test post-processor which produces test result reports.
internal class TestReportProcessor : TestPostProcessor {
override suspend fun invoke(options: TestPostProcessingOptions, results: TestRunResult): Tool.Result {
// @TODO not yet implemented
return Tool.Result.Success
}

// Create a coverage report processor if coverage is enabled.
class Factory : TestPostProcessorFactory<TestReportProcessor> {
override fun create(options: TestPostProcessingOptions): TestPostProcessor? = when (options.reportingEnabled) {
false -> null
else -> TestReportProcessor()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ import kotlin.time.TimeMark
import kotlin.time.TimeSource
import elide.runtime.core.DelicateElideApi
import elide.runtime.core.PolyglotContext
import elide.runtime.intrinsics.testing.Reason
import elide.runtime.intrinsics.testing.TestEntrypoint
import elide.runtime.intrinsics.testing.TestResult
import elide.runtime.intrinsics.testing.TestingRegistrar.*
import elide.tooling.config.TestConfigurator
import elide.tooling.config.TestConfigurator.TestEventController
import elide.tooling.testing.Reason
import elide.tooling.testing.TestCaseResult
import elide.tooling.testing.TestResult
import elide.tooling.testing.TestRunResult
import elide.tooling.testing.TestScope
import elide.tooling.testing.TestStats

// Provides abstract base behavior for test runner implementations.
public abstract class AbstractTestRunner (
Expand Down Expand Up @@ -74,57 +78,6 @@ public abstract class AbstractTestRunner (
val context: PolyglotContext,
)

/**
* Stats describing a test run.
*
* @property tests Total number of tests seen.
* @property executions Total number of tests ran.
* @property passes Total number of tests that passed.
* @property fails Total number of tests that failed.
* @property skips Total number of tests that were skipped.
* @property duration Total duration of the test run.
*/
@JvmRecord public data class TestStats(
public val tests: UInt,
public val executions: UInt,
public val passes: UInt,
public val fails: UInt,
public val skips: UInt,
public val duration: Duration,
)

/**
* Results of an individual test case run.
*
* @property scope The scope in which the test was a member.
* @property case The test case that was executed.
* @property result The result of the test case execution.
* @property duration The duration of the test case execution.
*/
@JvmRecord public data class TestCaseResult(
public val scope: TestScope<*>,
public val case: RegisteredTest,
public val result: TestResult,
public val duration: Duration,
)

/**
* Results of a test run.
*
* @property result The overall result of the test run.
* @property exitCode The exit code of the test run.
* @property stats Statistics about the test run.
* @property results Results of individual test cases.
* @property earlyExit Whether the test run exited early (e.g. due to a failure during `failFast` mode).
*/
@JvmRecord public data class TestRunResult(
public val result: TestResult,
public val exitCode: UInt,
public val stats: TestStats,
public val results: List<TestCaseResult>,
public val earlyExit: Boolean = false,
)

// Running count of all seen tests.
private val tests = atomic(0u)

Expand Down Expand Up @@ -212,7 +165,6 @@ public abstract class AbstractTestRunner (
results = testResults.map {
TestCaseResult(
scope = it.scope,
case = it.test,
result = it.result,
duration = it.timing,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import kotlinx.coroutines.async
import kotlin.time.measureTimedValue
import elide.runtime.core.DelicateElideApi
import elide.runtime.core.PolyglotContext
import elide.runtime.intrinsics.testing.TestResult
import elide.tooling.cli.Statics
import elide.tooling.config.TestConfigurator.TestEventController
import elide.tooling.testing.TestResult

// Implements a `TestRunner` which runs tests in order, serially.
public class SerialTestRunner internal constructor (
Expand Down
Loading
Loading