|
26 | 26 | import java.util.stream.Collectors; |
27 | 27 |
|
28 | 28 | import org.apache.commons.io.FileUtils; |
| 29 | +import org.hamcrest.CoreMatchers; |
| 30 | +import org.hamcrest.MatcherAssert; |
29 | 31 | import org.junit.AfterClass; |
30 | 32 | import org.junit.Assert; |
31 | 33 | import org.junit.Before; |
@@ -288,17 +290,32 @@ public void should_GenerateTsConfigAndTsDefinitions_When_Vaadin14BootstrapMode() |
288 | 290 | new DefaultClassFinder(this.getClass().getClassLoader())) |
289 | 291 | .when(mockedLookup).lookup(ClassFinder.class); |
290 | 292 | Builder builder = new Builder(mockedLookup, new File(userDir), TARGET) |
291 | | - .enablePackagesUpdate(false).useV14Bootstrap(true) |
292 | | - .enableImportsUpdate(true).runNpmInstall(false) |
293 | | - .withEmbeddableWebComponents(false).useV14Bootstrap(false) |
294 | | - .withFlowResourcesFolder( |
| 293 | + .enablePackagesUpdate(false).enableImportsUpdate(true) |
| 294 | + .runNpmInstall(false).withEmbeddableWebComponents(false) |
| 295 | + .useV14Bootstrap(false).withFlowResourcesFolder( |
295 | 296 | new File(userDir, TARGET + "flow-frontend")); |
296 | 297 | builder.build().execute(); |
297 | 298 |
|
298 | 299 | Assert.assertTrue(new File(userDir, "tsconfig.json").exists()); |
299 | 300 | Assert.assertTrue(new File(userDir, "types.d.ts").exists()); |
300 | 301 | } |
301 | 302 |
|
| 303 | + @Test |
| 304 | + public void should_failWithMessage_When_Vaadin14BootstrapModeAndViteAreUsed() { |
| 305 | + Lookup mockedLookup = mock(Lookup.class); |
| 306 | + Mockito.doReturn( |
| 307 | + new DefaultClassFinder(this.getClass().getClassLoader())) |
| 308 | + .when(mockedLookup).lookup(ClassFinder.class); |
| 309 | + Builder builder = new Builder(mockedLookup, new File(userDir), TARGET) |
| 310 | + .useV14Bootstrap(true); |
| 311 | + |
| 312 | + IllegalStateException exception = Assert.assertThrows( |
| 313 | + IllegalStateException.class, () -> builder.build().execute()); |
| 314 | + MatcherAssert.assertThat(exception.getMessage(), |
| 315 | + CoreMatchers.containsString( |
| 316 | + "Vite build tool is not supported when 'useDeprecatedV14Bootstrapping' is used")); |
| 317 | + } |
| 318 | + |
302 | 319 | @Test |
303 | 320 | public void should_failWithExecutionFailedException_when_customWebpackConfigFileExist() |
304 | 321 | throws IOException { |
|
0 commit comments