дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-27 21:12:34 +02:00
fix(run): print each line of a JUnit test's output once (#6333)
With Run tests using: OpenIDEA, every line a JUnit Platform test printed showed twice: the runner enabled JUnit's output capture, whose StreamInterceptor also writes each line to the original System.out, and then reported the captured text again as testStdOut. The runner now captures System.out / System.err per thread itself, as Junit4Runner does: a thread's lines while it runs a test or a class's set-up go only into that test's or class's testStdOut / testStdErr, other output passes through, and JUnit's capture is turned off explicitly. The console now shows testStdErr as stderr, and "Show console when a message is printed to stderr" fires for it (also for Junit4Runner and the Gradle test init script). Fixes #6332 Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
1 джерело
d5bde9af67
коміт
5bcb37492f
14 files changed
+264
-56
No files matched your search
@@ -3,6 +3,7 @@ package sample;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -10,9 +11,22 @@ import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
class SampleTest {
|
||||
static {
|
||||
System.out.println("loaded");
|
||||
}
|
||||
|
||||
@BeforeAll
|
||||
static void setUp() {
|
||||
System.out.println("class set-up");
|
||||
}
|
||||
|
||||
@Test
|
||||
void passes() {
|
||||
void passes() throws InterruptedException {
|
||||
System.out.println("hello [ünï]");
|
||||
System.err.println("to stderr");
|
||||
Thread other = new Thread(() -> System.out.println("from a thread"));
|
||||
other.start();
|
||||
other.join();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Заблокувати користувача