Skip to content

Commit 2fa466a

Browse files
committed
fix: Expose META-INF/frontend classpath resources in DevModeInitializerTest
Configure the mock ResourceProvider in AbstractDevModeTest to return actual META-INF/frontend classpath resources so the frontend scanner can resolve @jsmodule files from flow-server.
1 parent 6e84c62 commit 2fa466a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

vaadin-dev-server/src/test/java/com/vaadin/base/devserver/startup/AbstractDevModeTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
import java.io.File;
2121
import java.io.IOException;
2222
import java.lang.reflect.Field;
23+
import java.net.URL;
2324
import java.util.Collections;
25+
import java.util.List;
2426
import java.util.concurrent.atomic.AtomicReference;
2527

2628
import org.junit.After;
@@ -131,7 +133,14 @@ public void teardown() {
131133

132134
protected void setupMockResourceProvider(
133135
ResourceProvider mockResourceProvider) throws IOException {
134-
136+
// Expose actual META-INF/frontend resources from the classpath so
137+
// that @JsModule files on UI (e.g. page-visibility.js) can be found
138+
// during frontend scanning.
139+
List<URL> frontendUrls = Collections.list(getClass().getClassLoader()
140+
.getResources(Constants.RESOURCES_FRONTEND_DEFAULT));
141+
Mockito.when(mockResourceProvider
142+
.getApplicationResources(Constants.RESOURCES_FRONTEND_DEFAULT))
143+
.thenReturn(frontendUrls);
135144
}
136145

137146
private void mockApplicationConfiguration(

0 commit comments

Comments
 (0)