diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/utils/DirectiveTestUtils.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/utils/DirectiveTestUtils.java index 500dd8090e8..5b74d77e2fd 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/utils/DirectiveTestUtils.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/utils/DirectiveTestUtils.java @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.js.backend.ast.*; import org.jetbrains.kotlin.js.inline.util.CollectUtilsKt; import org.jetbrains.kotlin.js.translate.expression.InlineMetadata; import org.jetbrains.kotlin.test.TargetBackend; +import org.junit.runners.model.MultipleFailureException; import java.util.*; @@ -364,9 +365,11 @@ public class DirectiveTestUtils { @NotNull String sourceCode, @NotNull TargetBackend targetBackend ) throws Exception { + List assertionErrors = new ArrayList<>(); for (DirectiveHandler handler : DIRECTIVE_HANDLERS) { - handler.process(ast, sourceCode, targetBackend); + handler.process(ast, sourceCode, targetBackend, assertionErrors); } + MultipleFailureException.assertEmpty(assertionErrors); } public static void checkFunctionContainsNoCalls(JsNode node, String functionName, @NotNull Set exceptFunctionNames) @@ -495,7 +498,10 @@ public class DirectiveTestUtils { * * @see ArgumentsHelper for arguments format */ - void process(@NotNull JsNode ast, @NotNull String sourceCode, @NotNull TargetBackend targetBackend) throws Exception { + void process(@NotNull JsNode ast, @NotNull String sourceCode, + @NotNull TargetBackend targetBackend, + List assertionErrors + ) throws Exception { List directiveEntries = findLinesWithPrefixesRemoved(sourceCode, directive); for (String directiveEntry : directiveEntries) { ArgumentsHelper arguments = new ArgumentsHelper(directiveEntry); @@ -503,12 +509,21 @@ public class DirectiveTestUtils { containsBackend(targetBackend, IGNORED_BACKENDS, arguments, false)) { continue; } - processEntry(ast, arguments); + try { + processEntry(ast, arguments); + } catch (AssertionError e) { + assertionErrors.add(e); + } } } abstract void processEntry(@NotNull JsNode ast, @NotNull ArgumentsHelper arguments) throws Exception; + @Override + public String toString() { + return getName(); + } + @NotNull String getName() { return directive;