From a45ecddef2ff63b8175e5c4dd1d39669c39af55b Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Sat, 28 Dec 2024 15:42:14 +0200 Subject: [PATCH 1/2] test: Use project .npmrc for tests Makes it possible to use a custom registry for dependency testing --- .../java/com/vaadin/hilla/internal/TaskTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java index db0a3e1c3f..d4c395488f 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java @@ -41,21 +41,25 @@ public void setUpTaskApplication() throws IOException, URISyntaxException, .resolve(getFrontendDirectory()); Files.createDirectories(frontendDir); - var packagesDirectory = Path + Path packagesPath = Path .of(getClass().getClassLoader().getResource("").toURI()) .getParent() // target .getParent() // engine-runtime .getParent() // java - .getParent() // packages + .getParent(); // packages + + Path projectRoot = packagesPath.getParent(); + Files.copy(projectRoot.resolve(".npmrc"), temporaryDirectory.resolve(".npmrc")); + var tsPackagesDirectory = packagesPath .resolve("ts"); var shellCmd = FrontendUtils.isWindows() ? Stream.of("cmd.exe", "/c") - : Stream. empty(); + : Stream.empty(); var npmCmd = Stream.of("npm", "--no-update-notifier", "--no-audit", "install", "--no-save", "--install-links"); - var generatorFiles = Files.list(packagesDirectory).map(Path::toString); + var generatorFiles = Files.list(tsPackagesDirectory).map(Path::toString); var command = Stream.of(shellCmd, npmCmd, generatorFiles) .flatMap(Function.identity()).toList(); From 66d4d1bcfcd1173154ca05af05cb79421d98d61c Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Sat, 28 Dec 2024 15:59:38 +0200 Subject: [PATCH 2/2] format --- .../test/java/com/vaadin/hilla/internal/TaskTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java index d4c395488f..ffab51e38d 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java @@ -49,17 +49,18 @@ public void setUpTaskApplication() throws IOException, URISyntaxException, .getParent(); // packages Path projectRoot = packagesPath.getParent(); - Files.copy(projectRoot.resolve(".npmrc"), temporaryDirectory.resolve(".npmrc")); - var tsPackagesDirectory = packagesPath - .resolve("ts"); + Files.copy(projectRoot.resolve(".npmrc"), + temporaryDirectory.resolve(".npmrc")); + var tsPackagesDirectory = packagesPath.resolve("ts"); var shellCmd = FrontendUtils.isWindows() ? Stream.of("cmd.exe", "/c") - : Stream.empty(); + : Stream. empty(); var npmCmd = Stream.of("npm", "--no-update-notifier", "--no-audit", "install", "--no-save", "--install-links"); - var generatorFiles = Files.list(tsPackagesDirectory).map(Path::toString); + var generatorFiles = Files.list(tsPackagesDirectory) + .map(Path::toString); var command = Stream.of(shellCmd, npmCmd, generatorFiles) .flatMap(Function.identity()).toList();