exposing sendMessage and phantom to templates

This commit is contained in:
Jarrod Overson 2013-02-05 14:13:10 -08:00
parent 74069dd929
commit 3eeb595ff6
5 changed files with 30 additions and 19 deletions

View File

@ -1,3 +1,7 @@
v0.3.1rc7:
date: 2013-01-22
changes:
- Exposed phantom and sendMessage to templates
v0.3.0rc7:
date: 2013-01-22
changes:

View File

@ -1,7 +1,7 @@
{
"name": "grunt-contrib-jasmine",
"description": "Run jasmine specs headlessly through PhantomJS.",
"version": "0.3.0rc7",
"version": "0.3.1rc7",
"homepage": "https://github.com/gruntjs/grunt-contrib-jasmine",
"author": {
"name": "Grunt Team",

View File

@ -17,7 +17,7 @@ module.exports = function(grunt) {
var phantomjs = require('grunt-lib-phantomjs').init(grunt);
// local lib
var jasmine = require('./lib/jasmine').init(grunt);
var jasmine = require('./lib/jasmine').init(grunt, phantomjs);
var junitTemplate = __dirname + '/jasmine/templates/JUnit.tmpl';

View File

@ -1,7 +1,6 @@
/*global window:false, alert:false, jasmine:false, Node:false, */
/*jshint curly:false*/
(function(){
'use strict';
var phantom = {};
@ -16,10 +15,13 @@
var args = [].slice.call( arguments );
var payload = JSON.stringify( args );
if (window._phantom) {
// alerts are the communication bridge to grunt
alert( payload );
}
};
(function(){
function PhantomReporter() {
this.started = false;
this.finished = false;

View File

@ -1,7 +1,7 @@
'use strict';
exports.init = function(grunt) {
exports.init = function(grunt, phantomjs) {
// node api
var fs = require('fs'),
path = require('path');
@ -70,7 +70,12 @@ exports.init = function(grunt) {
specrunner = path.join(baseDir,options.outfile);
if (options.template.process) {
source = options.template.process(grunt, exports, context);
var task = {
writeTempFile : exports.writeTempFile,
copyTempFile : exports.copyTempFile,
phantomjs : phantomjs
};
source = options.template.process(grunt, task, context);
grunt.file.write(specrunner, source);
} else {
grunt.file.copy(options.template, specrunner, {