Move node dev deps forward, add .jshintrc to support latest grunt-contrib-jshint and Code Climate score
This commit is contained in:
9
.jshintrc
Normal file
9
.jshintrc
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"bitwise": true,
|
||||||
|
"curly": true,
|
||||||
|
"freeze": true,
|
||||||
|
"immed": true,
|
||||||
|
"newcap": true,
|
||||||
|
"trailing": true,
|
||||||
|
"loopfunc": true
|
||||||
|
}
|
||||||
@@ -5,13 +5,7 @@ module.exports = {
|
|||||||
'lib/jasmine-core/jasmine.js'
|
'lib/jasmine-core/jasmine.js'
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
/* While it's possible that we could be considering unwanted prototype methods, mostly
|
jshintrc: '.jshintrc'
|
||||||
* we're doing this because the objects are being used as maps.
|
|
||||||
*/
|
|
||||||
forin: false,
|
|
||||||
|
|
||||||
/* We're fine with functions defined inside loops (setTimeout functions, etc) */
|
|
||||||
loopfunc: true
|
|
||||||
},
|
},
|
||||||
all: ['src/**/*.js']
|
all: ['src/**/*.js']
|
||||||
};
|
};
|
||||||
|
|||||||
10
package.json
10
package.json
@@ -4,10 +4,10 @@
|
|||||||
"version": "2.0.0-rc3",
|
"version": "2.0.0-rc3",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "~0.4.1",
|
"grunt": "~0.4.1",
|
||||||
"grunt-contrib-jshint": "~0.2.0",
|
"grunt-contrib-jshint": "~0.7.0",
|
||||||
"grunt-contrib-concat": "~0.1.3",
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
"grunt-contrib-compass": "~0.1.3",
|
"grunt-contrib-compass": "~0.6.0",
|
||||||
"grunt-contrib-compress": "~0.4.1",
|
"grunt-contrib-compress": "~0.5.2",
|
||||||
"shelljs": "~0.1.2"
|
"shelljs": "~0.1.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ getJasmineRequireObj().pp = function(j$) {
|
|||||||
|
|
||||||
PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
||||||
for (var property in obj) {
|
for (var property in obj) {
|
||||||
if (!obj.hasOwnProperty(property)) continue;
|
if (!obj.hasOwnProperty(property)) { continue; }
|
||||||
if (property == '__Jasmine_been_here_before__') continue;
|
if (property == '__Jasmine_been_here_before__') { continue; }
|
||||||
fn(property, obj.__lookupGetter__ ? (!j$.util.isUndefined(obj.__lookupGetter__(property)) &&
|
fn(property, obj.__lookupGetter__ ? (!j$.util.isUndefined(obj.__lookupGetter__(property)) &&
|
||||||
obj.__lookupGetter__(property) !== null) : false);
|
obj.__lookupGetter__(property) !== null) : false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ getJasmineRequireObj().ReportDispatcher = function() {
|
|||||||
|
|
||||||
for (var i = 0; i < dispatchedMethods.length; i++) {
|
for (var i = 0; i < dispatchedMethods.length; i++) {
|
||||||
var method = dispatchedMethods[i];
|
var method = dispatchedMethods[i];
|
||||||
this[method] = function(m) {
|
this[method] = (function(m) {
|
||||||
return function() {
|
return function() {
|
||||||
dispatch(m, arguments);
|
dispatch(m, arguments);
|
||||||
};
|
};
|
||||||
}(method);
|
}(method));
|
||||||
}
|
}
|
||||||
|
|
||||||
var reporters = [];
|
var reporters = [];
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var befores = this.beforeFns() || [],
|
var befores = this.beforeFns() || [],
|
||||||
afters = this.afterFns() || [],
|
afters = this.afterFns() || [],
|
||||||
thisOne = (this.fn.length) ? timeoutable(this.fn) : this.fn;
|
thisOne = (this.fn.length) ? timeoutable(this.fn) : this.fn;
|
||||||
var allFns = befores.concat(thisOne).concat(afters);
|
var allFns = befores.concat(thisOne).concat(afters);
|
||||||
|
|
||||||
this.queueRunner({
|
this.queueRunner({
|
||||||
@@ -78,18 +78,18 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function onException(e) {
|
function onException(e) {
|
||||||
if (Spec.isPendingSpecException(e)) {
|
if (Spec.isPendingSpecException(e)) {
|
||||||
self.pend();
|
self.pend();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.addExpectationResult(false, {
|
self.addExpectationResult(false, {
|
||||||
matcherName: "",
|
matcherName: "",
|
||||||
passed: false,
|
passed: false,
|
||||||
expected: "",
|
expected: "",
|
||||||
actual: "",
|
actual: "",
|
||||||
error: e
|
error: e
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function complete() {
|
function complete() {
|
||||||
|
|||||||
@@ -51,18 +51,18 @@ getJasmineRequireObj().base = function(j$) {
|
|||||||
j$.createSpy = function(name, originalFn) {
|
j$.createSpy = function(name, originalFn) {
|
||||||
|
|
||||||
var spyStrategy = new j$.SpyStrategy({
|
var spyStrategy = new j$.SpyStrategy({
|
||||||
name: name,
|
name: name,
|
||||||
fn: originalFn,
|
fn: originalFn,
|
||||||
getSpy: function() { return spy; }
|
getSpy: function() { return spy; }
|
||||||
}),
|
}),
|
||||||
callTracker = new j$.CallTracker(),
|
callTracker = new j$.CallTracker(),
|
||||||
spy = function() {
|
spy = function() {
|
||||||
callTracker.track({
|
callTracker.track({
|
||||||
object: this,
|
object: this,
|
||||||
args: Array.prototype.slice.apply(arguments)
|
args: Array.prototype.slice.apply(arguments)
|
||||||
});
|
});
|
||||||
return spyStrategy.exec.apply(this, arguments);
|
return spyStrategy.exec.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var prop in originalFn) {
|
for (var prop in originalFn) {
|
||||||
if (prop === 'and' || prop === 'calls') {
|
if (prop === 'and' || prop === 'calls') {
|
||||||
@@ -83,7 +83,7 @@ getJasmineRequireObj().base = function(j$) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return putativeSpy.and instanceof j$.SpyStrategy &&
|
return putativeSpy.and instanceof j$.SpyStrategy &&
|
||||||
putativeSpy.calls instanceof j$.CallTracker;
|
putativeSpy.calls instanceof j$.CallTracker;
|
||||||
};
|
};
|
||||||
|
|
||||||
j$.createSpyObj = function(baseName, methodNames) {
|
j$.createSpyObj = function(baseName, methodNames) {
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
|
|
||||||
if (expected.length > 0) {
|
if (expected.length > 0) {
|
||||||
for (var i = 0; i < expected.length; i++) {
|
for (var i = 0; i < expected.length; i++) {
|
||||||
if (i > 0) message += ",";
|
if (i > 0) {
|
||||||
|
message += ",";
|
||||||
|
}
|
||||||
message += " " + j$.pp(expected[i]);
|
message += " " + j$.pp(expected[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,11 +87,11 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
|
|
||||||
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
||||||
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
||||||
if (a === b) return a !== 0 || 1 / a == 1 / b;
|
if (a === b) { return a !== 0 || 1 / a == 1 / b; }
|
||||||
// A strict comparison is necessary because `null == undefined`.
|
// A strict comparison is necessary because `null == undefined`.
|
||||||
if (a === null || b === null) return a === b;
|
if (a === null || b === null) { return a === b; }
|
||||||
var className = Object.prototype.toString.call(a);
|
var className = Object.prototype.toString.call(a);
|
||||||
if (className != Object.prototype.toString.call(b)) return false;
|
if (className != Object.prototype.toString.call(b)) { return false; }
|
||||||
switch (className) {
|
switch (className) {
|
||||||
// Strings, numbers, dates, and booleans are compared by value.
|
// Strings, numbers, dates, and booleans are compared by value.
|
||||||
case '[object String]':
|
case '[object String]':
|
||||||
@@ -113,14 +115,14 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
a.multiline == b.multiline &&
|
a.multiline == b.multiline &&
|
||||||
a.ignoreCase == b.ignoreCase;
|
a.ignoreCase == b.ignoreCase;
|
||||||
}
|
}
|
||||||
if (typeof a != 'object' || typeof b != 'object') return false;
|
if (typeof a != 'object' || typeof b != 'object') { return false; }
|
||||||
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
||||||
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
||||||
var length = aStack.length;
|
var length = aStack.length;
|
||||||
while (length--) {
|
while (length--) {
|
||||||
// Linear search. Performance is inversely proportional to the number of
|
// Linear search. Performance is inversely proportional to the number of
|
||||||
// unique nested structures.
|
// unique nested structures.
|
||||||
if (aStack[length] == a) return bStack[length] == b;
|
if (aStack[length] == a) { return bStack[length] == b; }
|
||||||
}
|
}
|
||||||
// Add the first object to the stack of traversed objects.
|
// Add the first object to the stack of traversed objects.
|
||||||
aStack.push(a);
|
aStack.push(a);
|
||||||
@@ -134,7 +136,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
if (result) {
|
if (result) {
|
||||||
// Deep compare the contents, ignoring non-numeric properties.
|
// Deep compare the contents, ignoring non-numeric properties.
|
||||||
while (size--) {
|
while (size--) {
|
||||||
if (!(result = eq(a[size], b[size], aStack, bStack, customTesters))) break;
|
if (!(result = eq(a[size], b[size], aStack, bStack, customTesters))) { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -151,13 +153,13 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|||||||
// Count the expected number of properties.
|
// Count the expected number of properties.
|
||||||
size++;
|
size++;
|
||||||
// Deep compare each member.
|
// Deep compare each member.
|
||||||
if (!(result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters))) break;
|
if (!(result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters))) { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ensure that both objects contain the same number of properties.
|
// Ensure that both objects contain the same number of properties.
|
||||||
if (result) {
|
if (result) {
|
||||||
for (key in b) {
|
for (key in b) {
|
||||||
if (has(b, key) && !(size--)) break;
|
if (has(b, key) && !(size--)) { break; }
|
||||||
}
|
}
|
||||||
result = !size;
|
result = !size;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,16 @@ getJasmineRequireObj().util = function() {
|
|||||||
var util = {};
|
var util = {};
|
||||||
|
|
||||||
util.inherit = function(childClass, parentClass) {
|
util.inherit = function(childClass, parentClass) {
|
||||||
var subclass = function() {
|
var Subclass = function() {
|
||||||
};
|
};
|
||||||
subclass.prototype = parentClass.prototype;
|
Subclass.prototype = parentClass.prototype;
|
||||||
childClass.prototype = new subclass();
|
childClass.prototype = new Subclass();
|
||||||
};
|
};
|
||||||
|
|
||||||
util.htmlEscape = function(str) {
|
util.htmlEscape = function(str) {
|
||||||
if (!str) return str;
|
if (!str) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
return str.replace(/&/g, '&')
|
return str.replace(/&/g, '&')
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>');
|
.replace(/>/g, '>');
|
||||||
@@ -18,7 +20,9 @@ getJasmineRequireObj().util = function() {
|
|||||||
|
|
||||||
util.argsToArray = function(args) {
|
util.argsToArray = function(args) {
|
||||||
var arrayOfArgs = [];
|
var arrayOfArgs = [];
|
||||||
for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
|
for (var i = 0; i < args.length; i++) {
|
||||||
|
arrayOfArgs.push(args[i]);
|
||||||
|
}
|
||||||
return arrayOfArgs;
|
return arrayOfArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
jasmineRequire.HtmlReporter = function(j$) {
|
jasmineRequire.HtmlReporter = function(j$) {
|
||||||
|
|
||||||
var noopTimer = {
|
var noopTimer = {
|
||||||
start: function(){},
|
start: function() {},
|
||||||
elapsed: function(){ return 0; }
|
elapsed: function() { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
function HtmlReporter(options) {
|
function HtmlReporter(options) {
|
||||||
@@ -73,7 +73,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
symbols.appendChild(createDom("li", {
|
symbols.appendChild(createDom("li", {
|
||||||
className: result.status,
|
className: result.status,
|
||||||
id: "spec_" + result.id,
|
id: "spec_" + result.id,
|
||||||
title: result.fullName}
|
title: result.fullName
|
||||||
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
if (result.status == "failed") {
|
if (result.status == "failed") {
|
||||||
|
|||||||
Reference in New Issue
Block a user