exposing sendMessage and phantom to templates
This commit is contained in:
parent
74069dd929
commit
3eeb595ff6
@ -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:
|
||||
|
@ -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",
|
||||
|
@ -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';
|
||||
|
||||
|
@ -1,24 +1,26 @@
|
||||
/*global window:false, alert:false, jasmine:false, Node:false, */
|
||||
/*jshint curly:false*/
|
||||
|
||||
(function(){
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var phantom = {};
|
||||
var phantom = {};
|
||||
|
||||
if (window._phantom) {
|
||||
console.log = function(){
|
||||
phantom.sendMessage('verbose',Array.prototype.slice.apply(arguments).join(', '));
|
||||
};
|
||||
}
|
||||
|
||||
phantom.sendMessage = function() {
|
||||
var args = [].slice.call( arguments );
|
||||
var payload = JSON.stringify( args );
|
||||
if (window._phantom) {
|
||||
alert( payload );
|
||||
}
|
||||
if (window._phantom) {
|
||||
console.log = function(){
|
||||
phantom.sendMessage('verbose',Array.prototype.slice.apply(arguments).join(', '));
|
||||
};
|
||||
}
|
||||
|
||||
phantom.sendMessage = function() {
|
||||
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;
|
||||
|
@ -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, {
|
||||
|
Loading…
Reference in New Issue
Block a user