FrontendTools { public void validateNodeAndNpmVersion() { if (ignoreVersionChecks) { return; } try { List<String> nodeVersionCommand = new ArrayList<>(); nodeVersionCommand.add(getNodeExecutable()); nodeVersionCommand.add("--version"); FrontendVersion foundNodeVersion = FrontendUtils.getVersion("node", nodeVersionCommand); FrontendUtils.validateToolVersion("node", foundNodeVersion, SUPPORTED_NODE_VERSION, SHOULD_WORK_NODE_VERSION); } catch (UnknownVersionException e) { getLogger().warn("Error checking if node is new enough", e); } try { List<String> npmVersionCommand = new ArrayList<>( getNpmExecutable(false)); npmVersionCommand.add("--version"); FrontendVersion npmVersion = FrontendUtils.getVersion("npm", npmVersionCommand); FrontendUtils.validateToolVersion("npm", npmVersion, SUPPORTED_NPM_VERSION, SHOULD_WORK_NPM_VERSION); checkForFaultyNpmVersion(npmVersion); } catch (UnknownVersionException e) { getLogger().warn("Error checking if npm is new enough", e); } } FrontendTools(String baseDir,
            Supplier<String> alternativeDirGetter);  FrontendTools(String baseDir,
                         Supplier<String> alternativeDirGetter,
                         String nodeVersion,
                         URI nodeDownloadRoot);   FrontendTools(String baseDir, Supplier<String> alternativeDirGetter,
            String nodeVersion, URI nodeDownloadRoot,
            boolean ignoreVersionChecks); String getNodeExecutable(); String forceAlternativeNodeExecutable(); List<String> getNpmExecutable(); List<String> getPnpmExecutable(); void ensurePnpm(); void validateNodeAndNpmVersion(); static final String DEFAULT_NODE_VERSION; static final String DEFAULT_PNPM_VERSION; static final String INSTALL_NODE_LOCALLY; static final int SUPPORTED_PNPM_MAJOR_VERSION; static final int SUPPORTED_PNPM_MINOR_VERSION; }
@Test public void validateNodeAndNpmVersion_pnpmLockIsNotRemoved() throws IOException { File file = new File(baseDir, "pnpm-lock.yaml"); file.createNewFile(); tools.validateNodeAndNpmVersion(); Assert.assertTrue(file.exists()); }