use of jenkins.plugins.nodejs.tools.NodeJSInstallation in project configuration-as-code-plugin by jenkinsci.
the class NodeJSTest method configure_nodejs.
@Test
@ConfiguredWithReadme("nodejs/README.md")
public void configure_nodejs() {
final NodeJSInstallation.DescriptorImpl descriptor = ExtensionList.lookupSingleton(NodeJSInstallation.DescriptorImpl.class);
assertEquals(1, descriptor.getInstallations().length);
final NodeJSInstallation nodejs = descriptor.getInstallations()[0];
final InstallSourceProperty installSourceProperty = nodejs.getProperties().get(InstallSourceProperty.class);
final NodeJSInstaller nodeJSInstaller = installSourceProperty.installers.get(NodeJSInstaller.class);
assertEquals("12.11.1", nodeJSInstaller.id);
assertEquals(48, nodeJSInstaller.getNpmPackagesRefreshHours().longValue());
}
use of jenkins.plugins.nodejs.tools.NodeJSInstallation in project nodejs-plugin by jenkinsci.
the class NodeJSBuildWrapperTest method test_calls_sequence_of_installer.
@Test
public void test_calls_sequence_of_installer() throws Exception {
FreeStyleProject job = j.createFreeStyleProject("free");
NodeJSInstallation installation = mockInstaller();
NodeJSBuildWrapper bw = mockWrapper(installation, mock(NPMConfig.class));
job.getBuildWrappersList().add(bw);
j.assertBuildStatusSuccess(job.scheduleBuild2(0));
verify(installation).forNode(any(Node.class), any(TaskListener.class));
verify(installation).forEnvironment(any(EnvVars.class));
verify(installation).buildEnvVars(any(EnvVars.class));
}
use of jenkins.plugins.nodejs.tools.NodeJSInstallation in project nodejs-plugin by jenkinsci.
the class NodeJSBuildWrapperTest method test_check_no_executable_in_installation_folder.
@Issue("JENKINS-45840")
@Test
public void test_check_no_executable_in_installation_folder() throws Exception {
FreeStyleProject job = j.createFreeStyleProject("free");
NodeJSInstallation installation = mockInstaller();
when(installation.getExecutable(any(Launcher.class))).thenReturn(null);
NodeJSBuildWrapper bw = mockWrapper(installation, mock(NPMConfig.class));
job.getBuildWrappersList().add(bw);
j.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0));
}
use of jenkins.plugins.nodejs.tools.NodeJSInstallation in project nodejs-plugin by jenkinsci.
the class NodeJSCommandInterpreterTest method test_set_of_cache_location.
@Test
public void test_set_of_cache_location() throws Exception {
final File cacheFolder = folder.newFolder();
NodeJSInstallation installation = mockInstaller();
NodeJSCommandInterpreter builder = CIBuilderHelper.createMock("test_creation_of_config", installation);
builder.setCacheLocationStrategy(new TestCacheLocationLocator(cacheFolder));
FreeStyleProject job = j.createFreeStyleProject("cache");
job.getBuildersList().add(builder);
job.getBuildersList().add(new EnvVarVerifier(NodeJSConstants.NPM_CACHE_LOCATION, cacheFolder.getAbsolutePath()));
j.assertBuildStatusSuccess(job.scheduleBuild2(0));
}
use of jenkins.plugins.nodejs.tools.NodeJSInstallation in project nodejs-plugin by jenkinsci.
the class NodeJSCommandInterpreterTest method test_check_no_executable_in_installation_folder.
@Issue("JENKINS-45840")
@Test
public void test_check_no_executable_in_installation_folder() throws Exception {
NodeJSInstallation installation = mockInstaller();
when(installation.getExecutable(any(Launcher.class))).thenReturn(null);
NodeJSCommandInterpreter builder = CIBuilderHelper.createMock("test_creation_of_config", installation, null);
FreeStyleProject job = j.createFreeStyleProject("free");
job.getBuildersList().add(builder);
j.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0));
}
Aggregations