aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2017-11-26 00:39:48 -0800
committerMark Otto <[email protected]>2017-11-26 00:39:48 -0800
commit3f02fe4012b7a2ba21f0f6aaf0348595e1fbb95e (patch)
tree55e1b16b38765c2d09d4be1878fe525dd22860a5
parent58286c1ba5c7f8a89500911a8256b1515a5005be (diff)
downloadbootstrap-3f02fe4012b7a2ba21f0f6aaf0348595e1fbb95e.tar.xz
bootstrap-3f02fe4012b7a2ba21f0f6aaf0348595e1fbb95e.zip
fix qunit test running by upgrading to latest version
-rw-r--r--js/tests/unit/phantom.js85
-rw-r--r--package.json2
2 files changed, 44 insertions, 43 deletions
diff --git a/js/tests/unit/phantom.js b/js/tests/unit/phantom.js
index 3ed3b3ea3..f6af10fdd 100644
--- a/js/tests/unit/phantom.js
+++ b/js/tests/unit/phantom.js
@@ -2,71 +2,72 @@
* grunt-contrib-qunit
* http://gruntjs.com/
*
- * Copyright (c) 2014 "Cowboy" Ben Alman, contributors
+ * Copyright (c) 2016 "Cowboy" Ben Alman, contributors
* Licensed under the MIT license.
*/
-(function () {
+/* global QUnit:true, alert:true */
+
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ require(['qunit'], factory);
+ } else {
+ factory(QUnit);
+ }
+}(function(QUnit) {
'use strict';
// Don't re-order tests.
- QUnit.config.reorder = false
- // Run tests serially, not in parallel.
- QUnit.config.autorun = false
+ QUnit.config.reorder = false;
// Send messages to the parent PhantomJS process via alert! Good times!!
function sendMessage() {
- var args = [].slice.call(arguments)
- alert(JSON.stringify(args))
+ var args = [].slice.call(arguments);
+ alert(JSON.stringify(args));
}
// These methods connect QUnit to PhantomJS.
- QUnit.log(function (obj) {
+ QUnit.log(function(obj) {
// What is this I don’t even
- if (obj.message === '[object Object], undefined:undefined') { return }
+ if (obj.message === '[object Object], undefined:undefined') {
+ return;
+ }
// Parse some stuff before sending it.
- var actual
- var expected
+ var actual;
+ var expected;
+
if (!obj.result) {
// Dumping large objects can be very slow, and the dump isn't used for
// passing tests, so only dump if the test failed.
- actual = QUnit.dump.parse(obj.actual)
- expected = QUnit.dump.parse(obj.expected)
+ actual = QUnit.dump.parse(obj.actual);
+ expected = QUnit.dump.parse(obj.expected);
}
// Send it.
- sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source)
- })
-
- QUnit.testStart(function (obj) {
- sendMessage('qunit.testStart', obj.name)
- })
+ sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source, obj.todo);
+ });
- QUnit.testDone(function (obj) {
- sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total, obj.duration)
- })
+ QUnit.testStart(function(obj) {
+ sendMessage('qunit.testStart', obj.name);
+ });
- QUnit.moduleStart(function (obj) {
- sendMessage('qunit.moduleStart', obj.name)
- })
+ QUnit.testDone(function(obj) {
+ sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total, obj.runtime, obj.skipped, obj.todo);
+ });
- QUnit.moduleDone(function (obj) {
- if (obj.failed === 0) {
- console.log('\r\u221A All tests passed in "' + obj.name + '" module')
- } else {
- console.log('\u00D7 ' + obj.failed + ' tests failed in "' + obj.name + '" module')
- }
- sendMessage('qunit.moduleDone', obj.name, obj.failed, obj.passed, obj.total)
- })
+ QUnit.moduleStart(function(obj) {
+ sendMessage('qunit.moduleStart', obj.name);
+ });
- QUnit.begin(function () {
- sendMessage('qunit.begin')
- console.log('\n\nStarting test suite')
- console.log('================================================\n')
- })
+ QUnit.moduleDone(function(obj) {
+ sendMessage('qunit.moduleDone', obj.name, obj.failed, obj.passed, obj.total);
+ });
- QUnit.done(function (obj) {
- sendMessage('qunit.done', obj.failed, obj.passed, obj.total, obj.runtime)
- })
+ QUnit.begin(function() {
+ sendMessage('qunit.begin');
+ });
-}())
+ QUnit.done(function(obj) {
+ sendMessage('qunit.done', obj.failed, obj.passed, obj.total, obj.runtime);
+ });
+}));
diff --git a/package.json b/package.json
index 7a1705f53..c18a4e19a 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,7 @@
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-less": "~1.3.0",
"grunt-contrib-pug": "~1.0.0",
- "grunt-contrib-qunit": "~0.7.0",
+ "grunt-contrib-qunit": "~2.0.0",
"grunt-contrib-uglify": "~1.0.0",
"grunt-contrib-watch": "~1.0.0",
"grunt-csscomb": "~3.1.0",