Plato is a code npm module which is used to generate HTML report on Javascript code analysis.
Install Plato
Same as Istanbul Plato is running over node, therefore the first step is to install node http://nodejs.org/
Once node is configured, install Instabull by running the command:
$ npm install plato
The code analysis report should be generated any time the build action of Jenkins is triggered. Run Plato any time after the workspace has been synced with the Repositories and before the build process is terminated. To run Plato during the build process Is necessary to modify the build.xml ANT file and add an extra task to execute Plato.
To run Plato launch the command
$ plato -r -d <output_dir> <input_dir>
The paramether -r is used to expand the input directory tree to search for the JS files.
The Jenkins customization to Integrating Plato are similar to the configuration to integrate Jenkins with istanbul.
In this page the step are described in short bullets; please refer to the Jenkins Integration with Istanbul for a detailed documentation.
JenkinsConfig/svyJenkinsConfig/CBI_config/jenkins_build.xml
Set advanced build properties:
work.servoy.install.dir = C:/Servoy
smart_test_solutions = servoyTestSolutionName
WORKSPACE = ${WORKSPACE}
ANT_CONTRIB_JAR = ${ANT_CONTRIB_JAR}
antRunner.dir = ${WORKSPACE}/JenkinsConfig/svyJenkinsConfig/CBI_config
servoy.test.property.file = ${WORKSPACE}/JenkinsConfig/svyJenkinsConfig/CBI_config/servoy.properties
workspace.plato.input.dir =solutionsDir
workspace.plato.output.dir =JenkinsConfig/svyJenkinsConfig/CBI_config/plato
code.analysis.exclude.modules = JenkinsConfig, solution_test, customFile.js
modify the export_and_test.properties to disable Plato during the build or to make the build fail if plato could not run with success.
Set make_code_analysis_report = yep to create code analysis report during build and always_fails_if_code_analysis_fails = true to force build to fail when an error occurs during the creation of code analysis report.
The properties workspace.plato.input.dir and workspace.plato.output.dir are custom properties used to specify the input directory and the output directory for plato. Those directories are not absolute but are relative to the servoy workspace directory. For example if the workspace directory is set to WORKSPACE=C:/user/workspace and the Plato input directory is set to workspace.plato.input.dir=svyUtils then Plato will use as input directory C:/user/workspace/svyUtils
Install the Jenkins plugin https://wiki.jenkins-ci.org/display/JENKINS/HTML+Publisher+Plugin.
Once the plugin is installed create the Post-build action in Jenkins Publish HTML reports. Specify the relative path from the Jenkins workspace to the index.html page created by plato. The index.html has been created by Plato in the relative directory specified in the property workspace.plato.output.dir. The index.html page will be then accessible from Jenkins.