Merge branch 'saucelabs-test-fix' into saucelabs-tests
Conflicts: Gruntfile.js package.json tests/mithril-tests.js tests/test.js
This commit is contained in:
commit
21d6351136
5 changed files with 95 additions and 40 deletions
|
|
@ -1,5 +1,5 @@
|
|||
_ = require('lodash')
|
||||
module.exports = function(grunt) {
|
||||
_ = require('lodash');
|
||||
|
||||
var version = "0.1.19"
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ module.exports = function(grunt) {
|
|||
];
|
||||
|
||||
var sauceOnTestComplete = function(result, callback) {
|
||||
var request = require('request')
|
||||
var request = require('request');
|
||||
|
||||
var user = process.env.SAUCE_USERNAME;
|
||||
var pass = process.env.SAUCE_ACCESS_KEY;
|
||||
|
|
@ -198,7 +198,7 @@ module.exports = function(grunt) {
|
|||
grunt.loadNpmTasks('grunt-zip');
|
||||
grunt.loadNpmTasks('grunt-contrib-qunit');
|
||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||
grunt.loadNpmTasks('grunt-saucelabs')
|
||||
grunt.loadNpmTasks('grunt-saucelabs');
|
||||
|
||||
grunt.registerTask("build", ["test", "uglify", "zip", "md2html", "replace", "copy", "clean"]);
|
||||
grunt.registerTask("test", ["concat", "execute"]);
|
||||
|
|
@ -207,5 +207,5 @@ module.exports = function(grunt) {
|
|||
|
||||
grunt.registerTask("sauce-qunit", ["connect", "saucelabs-qunit"]);
|
||||
grunt.registerTask("sauce-custom", ["connect", "saucelabs-custom"]);
|
||||
grunt.registerTask("sauce-all", ["connect", "saucelabs-qunit", "saucelabs-custom"])
|
||||
grunt.registerTask("sauce-all", ["connect", "saucelabs-qunit", "saucelabs-custom"]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -674,9 +674,39 @@ if (typeof define == "function" && define.amd) define(function() {return m})
|
|||
;;;
|
||||
|
||||
function test(condition) {
|
||||
try {if (!condition()) throw new Error}
|
||||
catch (e) {console.error(e);test.failures.push(condition)}
|
||||
var duration = 0;
|
||||
var start = 0;
|
||||
var result = true;
|
||||
test.total++
|
||||
|
||||
if (typeof window != "undefined") {
|
||||
if (typeof performance != "undefined") {
|
||||
start = performance.now();
|
||||
}
|
||||
try {if (!condition()) throw new Error}
|
||||
catch (e) {result = false;console.error(e);test.failures.push(condition)}
|
||||
if (typeof performance != "undefined") {
|
||||
duration = performance.now() - start;
|
||||
}
|
||||
|
||||
|
||||
test_obj = {
|
||||
name: "" + test.total,
|
||||
result: result,
|
||||
duration: duration
|
||||
}
|
||||
if (!result) {
|
||||
message: "failed: " + condition,
|
||||
window.global_test_results.tests.push(test_obj)
|
||||
}
|
||||
|
||||
window.global_test_results.duration += duration;
|
||||
if (result) {
|
||||
window.global_test_results.passed++;
|
||||
} else {
|
||||
window.global_test_results.failed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
test.total = 0
|
||||
test.failures = []
|
||||
|
|
@ -2381,7 +2411,17 @@ function testMithril(mock) {
|
|||
|
||||
}
|
||||
|
||||
//mocks
|
||||
testMithril(mock.window)
|
||||
//test reporting for saucelabs
|
||||
if (typeof window != "undefined") {
|
||||
window.global_test_results = {
|
||||
tests: [],
|
||||
duration: 0,
|
||||
passed: 0,
|
||||
failed: 0
|
||||
};
|
||||
}
|
||||
|
||||
test.print(console.log)
|
||||
//mock
|
||||
testMithril(mock.window);
|
||||
|
||||
test.print(function(value){console.log(value)});
|
||||
12
package.json
12
package.json
|
|
@ -17,11 +17,21 @@
|
|||
"grunt-contrib-qunit": "*",
|
||||
"grunt-contrib-connect": "*",
|
||||
"grunt-zip": "*",
|
||||
|
||||
"grunt-contrib-connect": "~0.7.1",
|
||||
"grunt-contrib-jshint": "~0.10.0",
|
||||
"grunt-contrib-watch": "~0.6.1",
|
||||
"grunt-jscs-checker": "^0.4.4",
|
||||
"grunt-sauce-tunnel": "^0.2.1",
|
||||
"load-grunt-config": "^0.9.2",
|
||||
"merge": "^1.1.3",
|
||||
"publish": "~0.3.2",
|
||||
"grunt-saucelabs": "*",
|
||||
"request": "~2.35.0",
|
||||
"q": "~1.0.0",
|
||||
"saucelabs": "~0.1.1",
|
||||
"sauce-tunnel": "~2.0.6",
|
||||
"colors": "~0.6.2",
|
||||
"lodash": "~2.4.1"
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1576,12 +1576,14 @@ function testMithril(mock) {
|
|||
}
|
||||
|
||||
//test reporting for saucelabs
|
||||
window.global_test_results = {
|
||||
tests: [],
|
||||
duration: 0,
|
||||
passed: 0,
|
||||
failed: 0
|
||||
};
|
||||
if (typeof window != "undefined") {
|
||||
window.global_test_results = {
|
||||
tests: [],
|
||||
duration: 0,
|
||||
passed: 0,
|
||||
failed: 0
|
||||
};
|
||||
}
|
||||
|
||||
//mock
|
||||
testMithril(mock.window);
|
||||
|
|
|
|||
|
|
@ -1,33 +1,36 @@
|
|||
function test(condition) {
|
||||
var duration = 0;
|
||||
var start = 0;
|
||||
var result = true
|
||||
if (performance.now) {
|
||||
start = performance.now();
|
||||
}
|
||||
try {if (!condition()) throw new Error}
|
||||
catch (e) {result = false;console.error(e);test.failures.push(condition)}
|
||||
if (performance.now) {
|
||||
duration = performance.now() - start;
|
||||
}
|
||||
|
||||
var result = true;
|
||||
test.total++
|
||||
|
||||
test_obj = {
|
||||
name: "" + test.total,
|
||||
result: result,
|
||||
duration: duration
|
||||
}
|
||||
if (!result) {
|
||||
message: "failed: " + condition,
|
||||
window.global_test_results.tests.push(test_obj)
|
||||
}
|
||||
if (typeof window != "undefined") {
|
||||
if (typeof performance != "undefined") {
|
||||
start = performance.now();
|
||||
}
|
||||
try {if (!condition()) throw new Error}
|
||||
catch (e) {result = false;console.error(e);test.failures.push(condition)}
|
||||
if (typeof performance != "undefined") {
|
||||
duration = performance.now() - start;
|
||||
}
|
||||
|
||||
window.global_test_results.duration += duration;
|
||||
if (result) {
|
||||
window.global_test_results.passed++;
|
||||
} else {
|
||||
window.global_test_results.failed++;
|
||||
|
||||
test_obj = {
|
||||
name: "" + test.total,
|
||||
result: result,
|
||||
duration: duration
|
||||
}
|
||||
if (!result) {
|
||||
message: "failed: " + condition,
|
||||
window.global_test_results.tests.push(test_obj)
|
||||
}
|
||||
|
||||
window.global_test_results.duration += duration;
|
||||
if (result) {
|
||||
window.global_test_results.passed++;
|
||||
} else {
|
||||
window.global_test_results.failed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
test.total = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue