Skip to content

Using Intern with Grunt

vladikoff edited this page Apr 30, 2013 · 14 revisions

Grunt support is built into Intern. Install Intern and load the Grunt task into your Gruntfile using grunt.loadTasks('path/to/intern/grunt');.

An example of the Grunt Intern task is available in the intern-examples repository.

Task Options

Name
Default
Description
runType
client
Example: "runner" or "client"
config
Example: "intern-selftest/tests/selftest.intern.js"
reporters
Example: ['console', 'lcov']
suites
Example: ['intern-selftest/tests/all']
proxyOnly
Example: true
autoRun
Example: true

Configuration Examples

All Task Options

grunt.initConfig({
    intern: {
        someReleaseTarget: {
            runType: 'runner',  // defaults to client,
            options: {
                config: "intern-selftest/tests/selftest.intern.js",
                reporters: ['console', 'lcov'],
                suites: ['intern-selftest/tests/all'],
                proxyOnly: true,
                autoRun: true
            }
        },
        anotherReleaseTarget: { ... }
    }
});

Full example

grunt.initConfig({
    intern: {
        local: {
	    options: {
		teststackDir: './intern',
		config: 'tests/intern.js'
            }
	}
    }
});
// Load the Intern task
grunt.loadTasks('./intern/grunt');

// Register a test task
grunt.registerTask('test', ['intern']);

// By default we just test
grunt.registerTask('default', ['test']);