Skip to content
Open
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
3 changes: 2 additions & 1 deletion be-js/src/commonMain/kotlin/lang/temper/be/js/RunJs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ internal fun runJsBestEffort(
when (request) {
is RunBackendSpecificCompilationStepRequest -> error("$request")
is RunLibraryRequest -> {
// Null for a library the build does not know, which the metadata check below reports.
mainLibraryConfig = dependencies.libraryConfigurations
.byLibraryName.getValue(request.libraryName)
.byLibraryName[request.libraryName]
val jsLibraryName = dependencies.metadata[request.libraryName, JsMetadataKey.JsLibraryName]
?: return listOf(
ToolchainResult(result = RFailure(CliFailure("No JS library name for $request"))),
Expand Down
21 changes: 21 additions & 0 deletions cli/src/test/kotlin/lang/temper/cli/RunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertContains
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue

class RunTest {
Expand Down Expand Up @@ -106,6 +107,26 @@ class RunTest {
@Test
fun runJsBackend() = runRunTest("run", JsBackend.Factory.backendId)

@Test
fun runJsBackendUnknownLibrary() {
val path = resourcePath("/run/input")
// Clean up in case someone ran a build in the source tree.
removeDirRecursive(path.resolve(TEMPER_OUT_NAME))
runWithTemporaryDirCopyOf("RunJsBackendUnknownLibrary", path) { tempDir ->
val result = doRun(
RunTask(
backends = setOf(JsBackend.Factory.backendId),
request = RunLibraryRequest(
DashedIdentifier.from("no-such-library")!!,
taskName = "RunJsBackendUnknownLibrary",
),
),
workRoot = tempDir,
)
assertFalse(result.ok)
}
}

@Ignore("Reexamine how import strategy and run tasks affect running only cherry-picked modules")
@Test
fun runJsBackendTop() = runRunTest("runTopLevel", JsBackend.Factory.backendId)
Expand Down
Loading