public abstract class AbstractJasmineMojo extends org.apache.maven.plugin.AbstractMojo implements JasmineConfiguration
| Modifier and Type | Field and Description |
|---|---|
protected int |
autoRefreshInterval
Automatically refresh the test runner at the given interval (specified in seconds) when using the
jasmine:bdd goal. |
protected boolean |
coffeeScriptCompilationEnabled
Control the Coffee Script compilation.
|
protected String |
connectorClass
Type of
Connector to use on the jetty server. |
protected String |
customRunnerConfiguration
Sometimes you want to have full control over how scriptloaders are configured.
|
protected String |
customRunnerTemplate
It may be the case that the jasmine-maven-plugin doesn't currently suit all of your needs,
and as a result the generated SpecRunner HTML files are set up in a way that you can't run
your specs.
|
protected boolean |
debug
True to increase HtmlUnit output and attempt reporting on specs even if a timeout occurred.
|
protected List<FileSystemReporter> |
fileSystemReporters
Specify a custom file system reporter to be used to store the test report.
|
protected boolean |
haltOnFailure
Halt the build on test failure.
|
protected File |
jasmineTargetDir
Target directory for files created by the plugin.
|
protected String |
manualSpecRunnerHtmlFileName
The name of the Manual Spec Runner.
|
protected org.apache.maven.project.MavenProject |
mavenProject |
protected boolean |
mvnTestSkip
Skip compilation and execution of tests.
|
protected List<String> |
preloadSources
JavaScript sources (typically vendor/lib dependencies) that need to be loaded
before other sources (and specs) in a particular order.
|
protected ReporterRetriever |
reporterRetriever |
protected List<Reporter> |
reporters
Specify a custom reporter to be used to print the test report.
|
protected ResourceRetriever |
resourceRetriever |
protected String |
serverHostname
Not used by the
jasmine:bdd goal. |
protected int |
serverPort
Used by the
jasmine:bdd goal to specify port to run the server under. |
protected boolean |
skipJasmineTests
Skip only jasmine tests
|
protected boolean |
skipTests
Skip execution of tests.
|
protected String |
sourceEncoding
The source encoding.
|
protected ScriptSearch |
sources |
protected String |
specDirectoryName
The name of the directory the specs will be deployed to on the server.
|
protected String |
specRunnerHtmlFileName
The name of the Spec Runner file.
|
protected SpecRunnerTemplate |
specRunnerTemplate
Determines the strategy to use when generation the JasmineSpecRunner.
|
protected ScriptSearch |
specs |
protected String |
srcDirectoryName
The name of the directory the sources will be deployed to on the server.
|
protected StringifiesStackTraces |
stringifiesStackTraces |
protected int |
timeout
Timeout for spec execution in seconds.
|
protected String |
uriScheme
Specify the URI scheme in which to access the SpecRunner.
|
| Constructor and Description |
|---|
AbstractJasmineMojo() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute() |
int |
getAutoRefreshInterval() |
File |
getBasedir() |
protected org.eclipse.jetty.server.Connector |
getConnector() |
List<Context> |
getContexts() |
File |
getCustomRunnerConfiguration() |
File |
getCustomRunnerTemplate() |
List<FileSystemReporter> |
getFileSystemReporters() |
File |
getJasmineTargetDir() |
org.apache.maven.project.MavenProject |
getMavenProject() |
List<String> |
getPreloadSources() |
ClassLoader |
getProjectClassLoader() |
List<Reporter> |
getReporters() |
String |
getSourceEncoding() |
ScriptSearch |
getSources() |
String |
getSpecDirectoryName() |
SpecRunnerTemplate |
getSpecRunnerTemplate() |
ScriptSearch |
getSpecs() |
String |
getSrcDirectoryName() |
boolean |
isCoffeeScriptCompilationEnabled() |
protected boolean |
isSkipTests() |
abstract void |
run() |
getLog, getPluginContext, setLog, setPluginContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLog@Parameter protected List<String> preloadSources
JavaScript sources (typically vendor/lib dependencies) that need to be loaded
before other sources (and specs) in a particular order. Each source will first be
searched for relative to ${jsSrcDir}, then ${jsTestSrcDir},
then (if it's not found in either) it will be included exactly as it appears in your POM.
Therefore, if jquery.js is in ${jsSrcDir}/vendor, you would configure:
<preloadSources> <source>vendor/jquery.js</source> </preloadSources>
And jquery.js would load before all the other sources and specs.
@Parameter protected String customRunnerTemplate
It may be the case that the jasmine-maven-plugin doesn't currently suit all of your needs, and as a result the generated SpecRunner HTML files are set up in a way that you can't run your specs. Have no fear! Simply specify a custom spec runner template in the plugin configuration and make the changes you need.
Potential values are a filesystem path, a URL, or a classpath resource. The default template is
stored in src/main/resources/jasmine-templates/SpecRunner.htmltemplate, and the
required template strings are tokenized in "$*$" patterns.
Example usage:
<customRunnerTemplate>${project.basedir}/src/test/resources/myCustomRunner.template</customRunnerTemplate>
@Parameter protected String customRunnerConfiguration
Sometimes you want to have full control over how scriptloaders are configured. In order to interpolate custom configuration into the generated runnerTemplate, specify a file containing the additional config. Potential values are a filesystem path, a URL, or a classpath resource.
Example usage:
<customRunnerConfiguration>${project.basedir}/src/test/resources/myCustomConfig.txt</customRunnerConfiguration>
@Parameter protected List<Reporter> reporters
Specify a custom reporter to be used to print the test report.
Example usage:
<reporters>
<reporter>
<reporterName>${project.basedir}/src/test/resources/myCustomReporter.js</reporterName>
</reporter>
<reporter>
<reporterName>STANDARD</reporterName>
</reporter>
</reporters>
@Parameter protected List<FileSystemReporter> fileSystemReporters
Specify a custom file system reporter to be used to store the test report.
Example usage:
<fileSystemReporters>
<reporter>
<fileName>MyFile.log</fileName>
<reporterName>${project.basedir}/src/test/resources/myCustomReporter.js</reporterName>
</reporter>
<reporter>
<fileName>Test-jasmine.xml</fileName>
<reporterName>JUNIT_XML</reporterName>
</reporter>
</fileSystemReporters>
@Parameter(defaultValue="${project.build.directory}${file.separator}jasmine")
protected File jasmineTargetDir
@Parameter(property="skipTests") protected boolean skipTests
@Parameter(property="maven.test.skip") protected boolean mvnTestSkip
@Parameter(property="skipJasmineTests") protected boolean skipJasmineTests
@Parameter(property="haltOnFailure",
defaultValue="true")
protected boolean haltOnFailure
@Parameter(defaultValue="300") protected int timeout
@Parameter(defaultValue="false") protected boolean debug
@Parameter(defaultValue="SpecRunner.html") protected String specRunnerHtmlFileName
@Parameter(defaultValue="ManualSpecRunner.html") protected String manualSpecRunnerHtmlFileName
@Parameter(defaultValue="spec") protected String specDirectoryName
@Parameter(defaultValue="src") protected String srcDirectoryName
@Parameter(defaultValue="${project.build.sourceEncoding}")
protected String sourceEncoding
@Parameter(property="jasmine.serverPort",
defaultValue="8234")
protected int serverPort
Used by the jasmine:bdd goal to specify port to run the server under.
The jasmine:test goal always uses a random available port so this property is ignored.
@Parameter(property="jasmine.uriScheme",
defaultValue="http")
protected String uriScheme
Specify the URI scheme in which to access the SpecRunner.
@Parameter(property="jasmine.serverHostname",
defaultValue="localhost")
protected String serverHostname
Not used by the jasmine:bdd goal.
The jasmine:test goal to specify hostname where the server is running. Useful when using
the RemoteWebDriver.
@Parameter(property="jasmine.specRunnerTemplate",
defaultValue="DEFAULT")
protected SpecRunnerTemplate specRunnerTemplate
Determines the strategy to use when generation the JasmineSpecRunner. This feature allows for custom implementation of the runner generator. Typically this is used when using different script runners.
Some valid examples: DEFAULT, REQUIRE_JS
@Parameter(property="jasmine.autoRefreshInterval",
defaultValue="0")
protected int autoRefreshInterval
Automatically refresh the test runner at the given interval (specified in seconds) when using the jasmine:bdd goal.
A value of 0 disables the automatic refresh (which is the default).
@Parameter(property="coffeeScriptCompilationEnabled",
defaultValue="true")
protected boolean coffeeScriptCompilationEnabled
Control the Coffee Script compilation. e.g. When using RequireJS the compilation happens within the Coffee Script AMD loader plugin; we therefore need to disable the compilation here.
@Parameter(property="jasmine.connectorClass",
defaultValue="org.eclipse.jetty.server.nio.SelectChannelConnector")
protected String connectorClass
Type of Connector to use on the jetty server.
Most users won't need to change this from the default value. It should only be used by advanced users.
@Parameter(defaultValue="${project}",
readonly=true)
protected org.apache.maven.project.MavenProject mavenProject
protected ResourceRetriever resourceRetriever
protected ReporterRetriever reporterRetriever
protected StringifiesStackTraces stringifiesStackTraces
protected ScriptSearch sources
protected ScriptSearch specs
public void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
execute in interface org.apache.maven.plugin.Mojoorg.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionpublic String getSourceEncoding()
getSourceEncoding in interface JasmineConfigurationpublic File getCustomRunnerTemplate()
getCustomRunnerTemplate in interface JasmineConfigurationpublic SpecRunnerTemplate getSpecRunnerTemplate()
getSpecRunnerTemplate in interface JasmineConfigurationpublic File getJasmineTargetDir()
getJasmineTargetDir in interface JasmineConfigurationpublic String getSrcDirectoryName()
getSrcDirectoryName in interface JasmineConfigurationpublic ScriptSearch getSources()
getSources in interface JasmineConfigurationpublic ScriptSearch getSpecs()
getSpecs in interface JasmineConfigurationpublic String getSpecDirectoryName()
getSpecDirectoryName in interface JasmineConfigurationpublic List<String> getPreloadSources()
getPreloadSources in interface JasmineConfigurationpublic int getAutoRefreshInterval()
getAutoRefreshInterval in interface JasmineConfigurationpublic boolean isCoffeeScriptCompilationEnabled()
isCoffeeScriptCompilationEnabled in interface JasmineConfigurationpublic org.apache.maven.project.MavenProject getMavenProject()
public File getCustomRunnerConfiguration()
getCustomRunnerConfiguration in interface JasmineConfigurationpublic List<Reporter> getReporters()
getReporters in interface JasmineConfigurationpublic List<FileSystemReporter> getFileSystemReporters()
getFileSystemReporters in interface JasmineConfigurationpublic File getBasedir()
getBasedir in interface JasmineConfigurationpublic ClassLoader getProjectClassLoader()
getProjectClassLoader in interface JasmineConfigurationpublic List<Context> getContexts()
getContexts in interface JasmineConfigurationprotected org.eclipse.jetty.server.Connector getConnector()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected boolean isSkipTests()
Copyright © 2016. All rights reserved.