
Security News
NIST Under Federal Audit for NVD Processing Backlog and Delays
As vulnerability data bottlenecks grow, the federal government is formally investigating NISTβs handling of the National Vulnerability Database.
grunt-jasmine-nodejs
Advanced tools
[DEPRECATED] Jasmine (v2.x) Grunt task for NodeJS. Supports Jasmine features such as fdescribe, fit, beforeAll, afterAll, etc... Built-in reporters: Default (Console) Reporter, JUnit XML, NUnit XML, TeamCity, TAP Reporter.
Β© 2018, Onur YΔ±ldΔ±rΔ±m (@onury). MIT License.
I stopped using Grunt (or Gulp) in my projects. Instead I'm using npm scripts.
Why? You can read these articles which I agree with:
Also see:
NOTE: If you like the default reporter of this plugin, I'm still maintaining Jasmine Console Reporter.
Jasmine (v2.x) Grunt multi-task for NodeJS with built-in reporters such as Default (Console) Reporter, JUnit XML, NUnit XML, Terminal Reporter, TeamCity, TAP Reporter. Supports the latest Jasmine features such as fdescribe
, fit
, beforeAll
, afterAll
, etc...
npm i grunt-jasmine-nodejs --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-jasmine-nodejs');
Run this task with the grunt jasmine_nodejs
command.
The --verbose
option will additionally output list of enabled reporters, spec and helper file lists.
Task targets, files and options may be specified according to the grunt Configuring tasks guide.
The --filter
option will filter the spec files by their file names that match the filter.
grunt jasmine_nodejs --filter=foo,bar
useHelpers : Boolean
β Default: true
Specifies whether to execute the helper files.
helpers : Array
β Default: []
Defines the global helper files to be loaded before running specs. These helpers will be available to all task targets. If you need to define target-specific helpers, define them within the target definition object.
random : Boolean
β Default: false
Specifies whether to run specs in semi-random order. Helpful for detecting inter-dependencies in between the specs.
seed : Number
β Default: null
Sets the randomization seed if randomization is turned on.
defaultTimeout : Number
β Default: 5000
By default Jasmine will wait for 5 seconds for an asynchronous spec to finish before causing a timeout failure. If the timeout expires before done is called, the current spec will be marked as failed and suite execution will continue as if done was called. You can set the default timeout value (in milliseconds) globally with this option. To set/change the timeout for a particular spec, just pass a third argument to the spec.
stopOnFailure : Boolean
β Default: false
Specifies whether to stop running further tests, on first expectation-failure. This can be useful if you want to debug your failed specs one by one. Note: Regardless of this option; the runner will still stop on suite failures (such as errors thrown in afterAll
, etc) and as normal, Grunt will abort when a task/target fails.
traceFatal : Number|Boolean
β Default: 1
On a fatal error (i.e. uncaughtException
), Grunt exits the process without a stack trace. This option forces Grunt to output the stack trace. Possible integer values: 0 to 2. Set to 1
(or true
) to only trace fatal errors. Set to 2
to also trace grunt warnings. This can also be achieved by the grunt --stack
command.
reporters : Object
β Default: undefined
Defines a list of built-in Jasmine reporter configurations to be used. If omitted, console
reporter will be used as default. See the definitions and corresponding options for each reporter below.
Note that reporters producing command-line output (such as console, terminal, teamcity and tap reporters), are not allowed to run at the same time, to prevent puzzled outputs. If still enabled, only the first one (in respective order) will be used. This is not the case for reporters producing a file.
reporters.console : Object
The built-in default reporter that outputs the detailed test results to the console, with colors.
colors : Number|Boolean
β Default: 1
Specifies whether the output should have colored text. Possible integer values: 0 to 2. Set to 1
(or true
) to enable colors. Set to 2
to use the ANSI escape codes. Option 2
can be useful if, for example, you're running your tests from a sub-process, and the colors aren't showing up.
cleanStack : Number|Boolean
β Default: 1
Specifies the filter level for the error stacks. Possible integer values: 0 to 3. Set to 1
(or true
) to only filter out lines with jasmine-core path from stacks. Set to 2
to filter out all node_modules
paths. Set to 3
to also filter out lines with no file path in it.
verbosity : Number|Boolean
β Default: 4
(alias: verbose
) Specifies the verbosity level for the reporter output. Possible integer values: 0 to 4. When a Boolean
value is passed, true
defaults to 4
and false
defaults to 0
. Level 0: reports errors only. Level 1: also displays a summary. Level 2: also reports pending specs. Level 3: additionally displays all suites and specs as a list, except disabled specs. Level 4: also lists disabled specs.
listStyle : String
β Default: "indent"
Indicates the style of suites/specs list output. Possible values: "flat"
or "indent"
. Setting this to "indent"
provides a better view especially when using nested (describe) suites. This option is only effective when verbosity level is set to 3
, 4
or true
.
activity : Boolean
β Default: false
Specifies whether to enable the activity indicator animation that outputs the current spec that is being executed. If your tests log extra data to console, this option should be disabled or they might be overwritten.
reporters.junit : Object
JUnit XML Reporter that outputs test results to a file in JUnit XML Report format. The default option values are set to create as few .xml files as possible. It is possible to save a single XML file, or an XML file for each top-level describe
, or an XML file for each describe
regardless of nesting.
savePath : String
β Default: ""
Defines the directory path to save output report files. This directory will be automatically created if it does not already exist.
filePrefix : String
β Default: "junitresults-"
Defines the string value that is prepended to the XML output file. If consolidateAll
is true, the default is simply "junitresults"
and this becomes the actual filename, i.e. "junitresults.xml"
.
consolidateAll : Boolean
β Default: true
Specifies whether to save all test results in a single file. If set to true
, filePrefix
is treated as the full file name (excluding extension).
consolidate : Boolean
β Default: true
Specifies whether to save nested describes within the same file as their parent. Setting to true
does nothing if consolidateAll
is also true
. Setting to false
will also set consolidateAll
to false
.
useDotNotation : Boolean
β Default: true
Specifies whether to separate suite names with dots instead of spaces. e.g. Class.init
instead of Class init
.
reporters.nunit : Object
NUnit XML Reporter that outputs test results to a file in NUnit XML Report format. Allows the test results to be used in java based CI systems like Jenkins.
savePath : String
β Default: ""
Defines the directory path to save output report files. This directory will be automatically created if it does not already exist.
filename : String
β Default: "nunitresults.xml"
Defines the name of xml output file.
reportName : String
β Default: "Jasmine Results"
Defines the name for parent test-results node.
reporters.terminal : Object
Similar to the default console reporter but simpler.
color : Boolean
β Default: false
Specifies whether the output should have colored text.
verbosity : Number
β Default: 2
Specifies the verbosity level for the reporter output. Possible integer values: 0 to 3.
showStack : Boolean
β Default: false
Specifies whether to show stack trace for failed specs.
reporters.teamcity : Boolean
TeamCity Reporter that outputs test results for the Teamcity build system. There are no options to specify for this reporter. Just set this to true
to enable the reporter.
reporters.tap : Boolean
Reporter for Test Anything Protocol (TAP), that outputs tests results to console. There are no options to specify for this reporter. Just set this to true
to enable the reporter.
customReporters : Array
β Default: undefined
Defines a list of custom Jasmine reporters to be used. Each item should be an initialized reporter instance with interfaces such as jasmineDone
, specDone
, etc...
grunt.initConfig({
jasmine_nodejs: {
// task specific (default) options
options: {
useHelpers: true,
// global helpers, available to all task targets. accepts globs..
helpers: [],
random: false,
seed: null,
defaultTimeout: null, // defaults to 5000
stopOnFailure: false,
traceFatal: true,
// configure one or more built-in reporters
reporters: {
console: {
colors: true, // (0|false)|(1|true)|2
cleanStack: 1, // (0|false)|(1|true)|2|3
verbosity: 4, // (0|false)|1|2|3|(4|true)
listStyle: "indent", // "flat"|"indent"
activity: false
},
// junit: {
// savePath: "./reports",
// filePrefix: "junit-report",
// consolidate: true,
// useDotNotation: true
// },
// nunit: {
// savePath: "./reports",
// filename: "nunit-report.xml",
// reportName: "Test Results"
// },
// terminal: {
// color: false,
// showStack: false,
// verbosity: 2
// },
// teamcity: true,
// tap: true
},
// add custom Jasmine reporter(s)
customReporters: []
},
your_target: {
// target specific options
options: {
useHelpers: true
},
// spec files
specs: [
"test/lib/**/*.spec.js",
"test/core/**/*.spec.js"
],
// target-specific helpers
helpers: [
"test/helpers/**/*.helper.js"
]
}
}
});
grunt.loadNpmTasks('grunt-jasmine-nodejs');
Note: The target-level reporters
object will override the task-level reporters
object all together. They will not be merged.
v1.6.0 (2017-03-05)
specNameSuffix
and helperNameSuffix
options are deprecated. Use glob notation when defining spec and helper files for any task target.helpers:Array
option that defines global helper files that are available to all task targets.v1.5.4 (2016-08-21)
cleanStack
option would render the first line as the error message, not respecting messages with \n
(new-line) in them. Fixed.v1.5.3 (2016-05-09)
v1.5.2 (2016-03-18)
jasmine-console-reporter
which improved the colors
option to support ANSI escape codes.v1.5.1 (2016-03-01)
String.prototype.endsWith()
ES6 method. (Fixes Issue #32).v1.5.0 (2016-02-26)
random
, seed
and defaultTimeout
. See docs.traceFatal
. See docs. (Fixes Issue #31)peerDependencies
to support Grunt 1.0.grunt.util._
refs (deprecated) in favor of lodash
as a dep.)v1.4.4 (2016-02-18)
--filter
option for the task. (PR @domtronn)v1.4.3 (2015-08-15)
v1.4.2 (2015-07-05)
verbosity
levels (0 to 4). Setting to 3
will not report disabled specs anymore while listing others. Set to 4
(default) for the most verbose report. (Fixes Issue #17)useHelpers
option does actually default to true
now.v1.4.0 (2015-05-01)
xit
specs are now treated as disabled
instead of pending
.stopOnFailure
. See documentation.v1.3.2 (2015-04-27)
report.console.activity
option to false
. This should not be enabled if your tests log extra data to console. Fixed activity output.v1.3.0 (2015-04-21)
reporters.console.colors
is enabled.cleanStack
now also accepts a Number
(integer) to determine the filter level. See documentation.listStyle
. See documentation.verbosity
(alias: verbose
) now also accepts a Number
(integer) to determine the verbosity level. See documentation.activity
. See documentation.showColors
and verboseReport
. Use reporters.console.colors
and reporters.console.verbosity
options instead.reporters.terminal
object to set its options.v1.0.2 (2015-03-11)
fit(...)
); which was breaking the spec-run. (Fixes Issue #9)v1.0.1 (2015-03-06)
v1.0.0 (2015-03-04)
reporters
. This object defines enabled reporters to be used in conjunction. See documentation.showColors
and verboseReport
. These are refactored under reporters.console
object.cleanStack
.customReporters
task option.--verbose
command.v0.4.1 (2015-03-03)
v0.4.0 (2015-03-01)
verboseReport
which reports a verbose list of all suites.v0.3.5 (2015-02-12)
TypeError
when a test fails.v0.3.1 (2015-02-07)
v0.3.0 (2015-02-07)
FAQs
[DEPRECATED] Jasmine (v2.x) Grunt task for NodeJS. Supports Jasmine features such as fdescribe, fit, beforeAll, afterAll, etc... Built-in reporters: Default (Console) Reporter, JUnit XML, NUnit XML, TeamCity, TAP Reporter.
The npm package grunt-jasmine-nodejs receives a total of 813 weekly downloads. As such, grunt-jasmine-nodejs popularity was classified as not popular.
We found that grunt-jasmine-nodejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NISTβs handling of the National Vulnerability Database.
Research
Security News
Socketβs Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.