Fork me on GitHub

jasmine:bdd

Full name:

com.github.searls:jasmine-maven-plugin:2.2:bdd

Description:

Execute specs in a web browser. Monitors your sources/specs for changes as you develop.

Attributes:

  • Requires a Maven project to be executed.
  • Executes by direct invocation only.
  • Requires dependency resolution of artifacts in scope: test.

Optional Parameters

Name Type Since Description
additionalContexts List 1.3.1.5

Specify additional contexts to make available.

<additionalContexts>
  <context>
    <contextRoot>lib</contextRoot>
    <directory>${project.basedir}/src/main/lib</directory>
  </context>
  <context>
    <contextRoot>test/lib</contextRoot>
    <directory>${project.basedir}/src/test/lib</directory>
  </context>
</additionalContexts>

autoRefreshInterval int 1.3.1.1

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).


Default value is: 0.
User property is: jasmine.autoRefreshInterval.
coffeeScriptCompilationEnabled boolean 1.3.1.4

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.


Default value is: true.
User property is: coffeeScriptCompilationEnabled.
connectorClass String 1.3.1.4

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.


Default value is: org.eclipse.jetty.server.nio.SelectChannelConnector.
User property is: jasmine.connectorClass.
customRunnerConfiguration String 1.1.0

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>

customRunnerTemplate String 1.1.0

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>

debug boolean 1.1.0 True to increase HtmlUnit output and attempt reporting on specs even if a timeout occurred.
Default value is: false.
fileSystemReporters List -

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>

haltOnFailure boolean 1.1.0 Halt the build on test failure.
Default value is: true.
User property is: haltOnFailure.
jasmineTargetDir File 1.1.0 Target directory for files created by the plugin.
Default value is: ${project.build.directory}${file.separator}jasmine.
jsSrcDir File 1.1.0 Directory storing your JavaScript.
Default value is: ${project.basedir}${file.separator}src${file.separator}main${file.separator}javascript.
User property is: jsSrcDir.
jsTestSrcDir File 1.1.0 Directory storing your Jasmine Specs.
Default value is: ${project.basedir}${file.separator}src${file.separator}test${file.separator}javascript.
User property is: jsTestSrcDir.
manualSpecRunnerHtmlFileName String 1.1.0 The name of the Manual Spec Runner.
Default value is: ManualSpecRunner.html.
mvnTestSkip boolean 1.3.1.3 Skip compilation and execution of tests.
User property is: maven.test.skip.
preloadSources List 1.1.0

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.


reporters List -

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>

serverHostname String 1.3.1.4

Not used by the jasmine:bdd goal.


The jasmine:test goal to specify hostname where the server is running. Useful when using the RemoteWebDriver.


Default value is: localhost.
User property is: jasmine.serverHostname.
serverPort int 1.1.0

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.


Default value is: 8234.
User property is: jasmine.serverPort.
skipJasmineTests boolean 1.3.1.3 Skip only jasmine tests
User property is: skipJasmineTests.
skipTests boolean 1.1.0 Skip execution of tests.
User property is: skipTests.
sourceEncoding String 1.1.0 The source encoding.
Default value is: ${project.build.sourceEncoding}.
sourceExcludes List 1.1.0

Just like sourceIncludes, but will exclude anything matching the provided patterns.

There are no sourceExcludes by default.


sourceIncludes List 1.1.0

Allows specifying which source files should be included and in what order.

<sourceIncludes>
  <include>vendor/**/*.js</include>
  <include>myBootstrapFile.js</include>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</sourceIncludes>

Default sourceIncludes:

<sourceIncludes>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</sourceIncludes>

specDirectoryName String 1.1.0 The name of the directory the specs will be deployed to on the server.
Default value is: spec.
specExcludes List 1.1.0

Just like specIncludes, but will exclude anything matching the provided patterns.

There are no specExcludes by default.


specIncludes List 1.1.0

I often find myself needing control of the spec include order when I have some global spec helpers or spec-scoped dependencies, like:

<specIncludes>
  <include>jasmine-jquery.js</include>
  <include>spec-helper.js</include>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</specIncludes>

Default specIncludes:

<specIncludes>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</specIncludes>

specRunnerHtmlFileName String 1.1.0 The name of the Spec Runner file.
Default value is: SpecRunner.html.
specRunnerTemplate SpecRunnerTemplate 1.1.0

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


Default value is: DEFAULT.
User property is: jasmine.specRunnerTemplate.
srcDirectoryName String 1.1.0 The name of the directory the sources will be deployed to on the server.
Default value is: src.
timeout int 1.1.0 Timeout for spec execution in seconds.
Default value is: 300.
uriScheme String 1.3.1.4

Specify the URI scheme in which to access the SpecRunner.


Default value is: http.
User property is: jasmine.uriScheme.

Parameter Details

additionalContexts:

Specify additional contexts to make available.

<additionalContexts>
  <context>
    <contextRoot>lib</contextRoot>
    <directory>${project.basedir}/src/main/lib</directory>
  </context>
  <context>
    <contextRoot>test/lib</contextRoot>
    <directory>${project.basedir}/src/test/lib</directory>
  </context>
</additionalContexts>
  • Type: java.util.List
  • Since: 1.3.1.5
  • Required: No

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).

  • Type: int
  • Since: 1.3.1.1
  • Required: No
  • User Property: jasmine.autoRefreshInterval
  • Default: 0

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.

  • Type: boolean
  • Since: 1.3.1.4
  • Required: No
  • User Property: coffeeScriptCompilationEnabled
  • Default: true

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.

  • Type: java.lang.String
  • Since: 1.3.1.4
  • Required: No
  • User Property: jasmine.connectorClass
  • Default: org.eclipse.jetty.server.nio.SelectChannelConnector

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>
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No

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>
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No

debug:

True to increase HtmlUnit output and attempt reporting on specs even if a timeout occurred.
  • Type: boolean
  • Since: 1.1.0
  • Required: No
  • Default: false

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>
  • Type: java.util.List
  • Required: No

haltOnFailure:

Halt the build on test failure.
  • Type: boolean
  • Since: 1.1.0
  • Required: No
  • User Property: haltOnFailure
  • Default: true

jasmineTargetDir:

Target directory for files created by the plugin.
  • Type: java.io.File
  • Since: 1.1.0
  • Required: No
  • Default: ${project.build.directory}${file.separator}jasmine

jsSrcDir:

Directory storing your JavaScript.
  • Type: java.io.File
  • Since: 1.1.0
  • Required: No
  • User Property: jsSrcDir
  • Default: ${project.basedir}${file.separator}src${file.separator}main${file.separator}javascript

jsTestSrcDir:

Directory storing your Jasmine Specs.
  • Type: java.io.File
  • Since: 1.1.0
  • Required: No
  • User Property: jsTestSrcDir
  • Default: ${project.basedir}${file.separator}src${file.separator}test${file.separator}javascript

manualSpecRunnerHtmlFileName:

The name of the Manual Spec Runner.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: ManualSpecRunner.html

mvnTestSkip:

Skip compilation and execution of tests.
  • Type: boolean
  • Since: 1.3.1.3
  • Required: No
  • User Property: maven.test.skip

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.

  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

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>
  • Type: java.util.List
  • Required: No

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.

  • Type: java.lang.String
  • Since: 1.3.1.4
  • Required: No
  • User Property: jasmine.serverHostname
  • Default: localhost

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.

  • Type: int
  • Since: 1.1.0
  • Required: No
  • User Property: jasmine.serverPort
  • Default: 8234

skipJasmineTests:

Skip only jasmine tests
  • Type: boolean
  • Since: 1.3.1.3
  • Required: No
  • User Property: skipJasmineTests

skipTests:

Skip execution of tests.
  • Type: boolean
  • Since: 1.1.0
  • Required: No
  • User Property: skipTests

sourceEncoding:

The source encoding.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: ${project.build.sourceEncoding}

sourceExcludes:

Just like sourceIncludes, but will exclude anything matching the provided patterns.

There are no sourceExcludes by default.

  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

sourceIncludes:

Allows specifying which source files should be included and in what order.

<sourceIncludes>
  <include>vendor/**/*.js</include>
  <include>myBootstrapFile.js</include>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</sourceIncludes>

Default sourceIncludes:

<sourceIncludes>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</sourceIncludes>
  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

specDirectoryName:

The name of the directory the specs will be deployed to on the server.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: spec

specExcludes:

Just like specIncludes, but will exclude anything matching the provided patterns.

There are no specExcludes by default.

  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

specIncludes:

I often find myself needing control of the spec include order when I have some global spec helpers or spec-scoped dependencies, like:

<specIncludes>
  <include>jasmine-jquery.js</include>
  <include>spec-helper.js</include>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</specIncludes>

Default specIncludes:

<specIncludes>
  <include>**/*.js</include>
  <include>**/*.coffee</include>
</specIncludes>
  • Type: java.util.List
  • Since: 1.1.0
  • Required: No

specRunnerHtmlFileName:

The name of the Spec Runner file.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: SpecRunner.html

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

  • Type: com.github.searls.jasmine.runner.SpecRunnerTemplate
  • Since: 1.1.0
  • Required: No
  • User Property: jasmine.specRunnerTemplate
  • Default: DEFAULT

srcDirectoryName:

The name of the directory the sources will be deployed to on the server.
  • Type: java.lang.String
  • Since: 1.1.0
  • Required: No
  • Default: src

timeout:

Timeout for spec execution in seconds.
  • Type: int
  • Since: 1.1.0
  • Required: No
  • Default: 300

uriScheme:

Specify the URI scheme in which to access the SpecRunner.

  • Type: java.lang.String
  • Since: 1.3.1.4
  • Required: No
  • User Property: jasmine.uriScheme
  • Default: http