-
Notifications
You must be signed in to change notification settings - Fork 308
Using Intern with Grunt
Grunt support is built into Intern. Install Intern and load the Grunt task into your Gruntfile
using grunt.loadTasks('path/to/intern/grunt');
(Intern 1.0) or grunt.loadNpmTasks('intern')
(Intern 1.1+).
An example of the Grunt Intern task is available in the intern-examples repository.
Options available when running Intern using Grunt are the same as the options available when running Intern directly from the command-line, plus the following additional options:
Name Default |
Description |
---|---|
runType client |
The execution mode in which Intern should be run. This may be either "runner" for the automated test runner, or "client" for the Node.js client. |
sauceUsername (none) |
The username for authentication with Sauce Labs. |
sauceAccessKey (none) |
The access key for authentication with Sauce Labs. |
Added in Intern 1.3
The current Grunt events are rudimentary, based on the output of the default console
reporter, and do not provide much detail into the actual state of the test runner to Grunt tasks. Future versions of Intern are likely to improve to provide first-class event support, if sufficient demand exists for this feature.
Event | Parameters | Description |
---|---|---|
intern.pass |
data - A string that contains the pass message. |
This event is emitted when a test passes. |
intern.fail |
data - A string that contains the failure message. |
This event is emitted when a test fails. |
grunt.initConfig({
intern: {
someReleaseTarget: {
options: {
runType: 'runner', // defaults to 'client'
config: 'tests/intern',
reporters: [ 'console', 'lcov' ],
suites: [ 'myPackage/tests/all' ]
}
},
anotherReleaseTarget: { /* ... */ }
}
});
// Load the Intern task
grunt.loadNpmTasks('intern');
// Register a test task that uses Intern
grunt.registerTask('test', [ 'intern' ]);
// By default we just test
grunt.registerTask('default', [ 'test' ]);