Add demo for the NodeJS plugin (#1153)
* Add demo for NodeJS * Add integration test for NodeJS * Fix build * Fix readme file extension case
This commit is contained in:
parent
154fe114de
commit
8eee4c307f
|
|
@ -0,0 +1,19 @@
|
|||
# Configure NodeJS
|
||||
|
||||
Basic configuration of [NodeJS](https://plugins.jenkins.io/nodejs)
|
||||
|
||||
## Sample configuration
|
||||
|
||||
```yaml
|
||||
tool:
|
||||
nodejs:
|
||||
installations:
|
||||
- name: "NodeJS Latest"
|
||||
home: "" #required until nodejs-1.3.4 release (JENKINS-57508)
|
||||
properties:
|
||||
- installSource:
|
||||
installers:
|
||||
- nodeJSInstaller:
|
||||
id: "12.11.1"
|
||||
npmPackagesRefreshHours: 48 #default is 72
|
||||
```
|
||||
|
|
@ -406,6 +406,19 @@
|
|||
<version>0.50.40</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jenkins-ci.plugins</groupId>
|
||||
<artifactId>nodejs</artifactId>
|
||||
<version>1.3.3</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.jenkins-ci.plugins</groupId>
|
||||
<artifactId>config-file-provider</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package io.jenkins.plugins.casc;
|
||||
|
||||
import hudson.ExtensionList;
|
||||
import hudson.tools.InstallSourceProperty;
|
||||
import io.jenkins.plugins.casc.misc.ConfiguredWithReadme;
|
||||
import io.jenkins.plugins.casc.misc.JenkinsConfiguredWithReadmeRule;
|
||||
import jenkins.plugins.nodejs.tools.NodeJSInstallation;
|
||||
import jenkins.plugins.nodejs.tools.NodeJSInstaller;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class NodeJSTest {
|
||||
|
||||
@Rule
|
||||
public JenkinsConfiguredWithReadmeRule j = new JenkinsConfiguredWithReadmeRule();
|
||||
|
||||
@Test
|
||||
@ConfiguredWithReadme("nodejs/README.md")
|
||||
public void configure_nodejs() throws Exception {
|
||||
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());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue