UNPKG

1.41 kBJavaScriptView Raw
1/*
2 * grunt
3 * https://github.com/cowboy/grunt
4 *
5 * Copyright (c) 2012 "Cowboy" Ben Alman
6 * Licensed under the MIT license.
7 * http://benalman.com/about/license/
8 */
9
10/*global QUnit:true, alert:true*/
11
12// Don't re-order tests.
13QUnit.config.reorder = false;
14// Run tests serially, not in parallel.
15QUnit.config.autorun = false;
16
17// Send messages to the parent zombie.js process via alert! Good times!!
18function sendMessage() {
19 var args = [].slice.call(arguments);
20 alert(JSON.stringify(args));
21}
22
23QUnit.log = function(obj) {
24 // What is this I don’t even
25 if (obj.message === '[object Object], undefined:undefined') { return; }
26 // Parse some stuff before sending it.
27 var actual = QUnit.jsDump.parse(obj.actual);
28 var expected = QUnit.jsDump.parse(obj.expected);
29 // Send it.
30 sendMessage('log', obj.result, actual, expected, obj.message, obj.source);
31};
32
33QUnit.testStart = function(obj) {
34 sendMessage('testStart', obj.name);
35};
36
37QUnit.testDone = function(obj) {
38 sendMessage('testDone', obj.name, obj.failed, obj.passed, obj.total);
39};
40
41QUnit.moduleStart = function(obj) {
42 sendMessage('moduleStart', obj.name);
43};
44
45QUnit.moduleDone = function(obj) {
46 sendMessage('moduleDone', obj.name, obj.failed, obj.passed, obj.total);
47};
48
49QUnit.begin = function() {
50 sendMessage('begin');
51};
52
53QUnit.done = function(obj) {
54 sendMessage('done', obj.failed, obj.passed, obj.total, obj.runtime);
55};