NodeUpdater implements FallibleCommand { static Set<String> getGeneratedModules(File directory, Set<String> excludes) { if (!directory.exists()) { return Collections.emptySet(); } final Function<String, String> unixPath = str -> str.replace("\\", "/"); final URI baseDir = directory.toURI(); return FileUtils.listFiles(directory, new String[] { "js" }, true) .stream().filter(file -> { String path = unixPath.apply(file.getPath()); if (path.contains("/node_modules/")) { return false; } return excludes.stream().noneMatch( postfix -> path.endsWith(unixPath.apply(postfix))); }) .map(file -> GENERATED_PREFIX + unixPath .apply(baseDir.relativize(file.toURI()).getPath())) .collect(Collectors.toSet()); } protected  NodeUpdater(ClassFinder finder,
            FrontendDependenciesScanner frontendDependencies, File npmFolder,
            File generatedPath, File flowResourcesPath);   }
@Test public void getGeneratedModules_should_excludeByFileName() throws IOException { File generated = temporaryFolder.newFolder(); File fileA = new File(generated, "a.js"); File fileB = new File(generated, "b.js"); File fileC = new File(generated, "c.js"); fileA.createNewFile(); fileB.createNewFile(); fileC.createNewFile(); Set<String> modules = NodeUpdater.getGeneratedModules(generated, Stream.of("a.js", "/b.js").collect(Collectors.toSet())); Assert.assertEquals(1, modules.size()); Assert.assertTrue(modules.contains("GENERATED/c.js")); }