gruntjs/grunt-contrib-connect — pull request #23 by jaredstehler (2013-03-28 21:18:51+00:00)
Title: Ability to start listening on ephemeral port

This patch allows grunt to start the server listening on any available port, and stores the server's bind info into the grunt config for downstream tasks.

Here's an example in action:

connect: {
test: {
options: {
port: 0
}
}
},

jasmine: {
tests: {
src: 'src/**/*.js',
options: {
specs: 'spec/*_spec.js',
helpers: 'spec/*_helper.js',
host: 'http://<%= grunt.config.get("connect.test.address").address %>:<%= grunt.config.get("connect.test.address").port %>/',
template: require('grunt-template-jasmine-steal'),
templateOptions: {
stealOptions: {
stealUrl: '/src/steal/steal.js',
baseUrl: '/'
}
}
}
}
}