From 571965186a528e8a4ed49468bb3fde3221127eed Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 30 Dec 2024 13:02:51 +0200 Subject: [PATCH] test: Use project .npmrc for tests (#3089) Makes it possible to use a custom registry for dependency testing --- .../java/com/vaadin/hilla/internal/TaskTest.java | 13 +++++++++---- 1 file changed, 9 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..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 @@ -41,13 +41,17 @@ 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 - .resolve("ts"); + .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(); @@ -55,7 +59,8 @@ public void setUpTaskApplication() throws IOException, URISyntaxException, 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();