jshint passes - run 'node jshint/run.js'. running jshint with a couple jshint options and workarounds to allow certain jasmine-specific styles. many actual style problems are fixed. the jshint run is integrated into rake jasmine:lint.
This commit is contained in:
+9
-9
@@ -3,10 +3,10 @@ var sys = require('sys');
|
||||
var path = require('path');
|
||||
|
||||
// yes, really keep this here to keep us honest, but only for jasmine's own runner! [xw]
|
||||
undefined = "diz be undefined yo";
|
||||
// undefined = "diz be undefined yo";
|
||||
|
||||
var jasmineGlobals = require("../src/base");
|
||||
for(var k in jasmineGlobals) {global[k] = jasmineGlobals[k]};
|
||||
for(var k in jasmineGlobals) {global[k] = jasmineGlobals[k];}
|
||||
|
||||
//load jasmine src files based on the order in runner.html
|
||||
var srcFilesInProperRequireOrder = [];
|
||||
@@ -15,7 +15,7 @@ var srcFileLines = [];
|
||||
for (var i=0; i<runnerHtmlLines.length; i++)
|
||||
if (runnerHtmlLines[i].match(/script(.*?)\/src\//))
|
||||
srcFileLines.push(runnerHtmlLines[i]);
|
||||
for (i=0; i<srcFileLines.length; i++) srcFilesInProperRequireOrder.push(/src=\"(.*?)\"/(srcFileLines[i])[1]);
|
||||
for (i=0; i<srcFileLines.length; i++) srcFilesInProperRequireOrder.push(srcFileLines[i].match(/src=\"(.*?)\"/)[1]);
|
||||
for (i=0; i<srcFilesInProperRequireOrder.length; i++) require(srcFilesInProperRequireOrder[i]);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ jasmine.executeSpecs = function(specs, done, isVerbose, showColors){
|
||||
|
||||
reportRunnerStarting: function(runner) {
|
||||
sys.puts('Started');
|
||||
start = Number(new Date);
|
||||
start = new Date().getTime();
|
||||
},
|
||||
|
||||
reportSuiteResults: function(suite) {
|
||||
@@ -112,7 +112,7 @@ jasmine.executeSpecs = function(specs, done, isVerbose, showColors){
|
||||
|
||||
|
||||
reportRunnerResults: function(runner) {
|
||||
elapsed = (Number(new Date) - start) / 1000;
|
||||
elapsed = (new Date().getTime() - start) / 1000;
|
||||
sys.puts('\n');
|
||||
log.forEach(function(log){
|
||||
sys.puts(log);
|
||||
@@ -216,16 +216,16 @@ process.argv.forEach(function(arg){
|
||||
}
|
||||
});
|
||||
|
||||
var specs = jasmine.getAllSpecFiles(__dirname + '/suites', new RegExp("^.+\.(js|coffee)$"));
|
||||
var specs = jasmine.getAllSpecFiles(__dirname + '/suites', new RegExp(".js$"));
|
||||
var domIndependentSpecs = [];
|
||||
for(var i=0; i<specs.length; i++) {
|
||||
if (fs.readFileSync(specs[i], "utf8").indexOf("document.createElement")<0) {
|
||||
domIndependentSpecs.push(specs[i]);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
jasmine.executeSpecs(domIndependentSpecs, function(runner, log){
|
||||
if (runner.results().failedCount == 0) {
|
||||
if (runner.results().failedCount === 0) {
|
||||
process.exit(0);
|
||||
} else {
|
||||
process.exit(1);
|
||||
|
||||
@@ -108,7 +108,7 @@ describe("jasmine.Env", function() {
|
||||
|
||||
it("should give custom equality testers precedence", function() {
|
||||
expect(env.equals_('abc', 'abc')).toBeFalsy();
|
||||
var o = new Object();
|
||||
var o = {};
|
||||
expect(env.equals_(o, o)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -89,9 +89,9 @@ describe('Exceptions:', function() {
|
||||
expect(blockResults[0].message).toMatch(/fake error 1/);
|
||||
|
||||
expect(specResults[1].passed()).toEqual(false);
|
||||
var blockResults = specResults[1].getItems();
|
||||
blockResults = specResults[1].getItems();
|
||||
expect(blockResults[0].passed()).toEqual(false);
|
||||
expect(blockResults[0].message).toMatch(/fake error 2/),
|
||||
expect(blockResults[0].message).toMatch(/fake error 2/);
|
||||
expect(blockResults[1].passed()).toEqual(true);
|
||||
|
||||
expect(specResults[2].passed()).toEqual(true);
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('jasmine.jsApiReporter', function() {
|
||||
nestedSuite = env.describe("nested suite", function() {
|
||||
nestedSpec = env.it("nested spec", function() {
|
||||
expect(true).toEqual(true);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
spec3 = env.it("spec 3", function() {
|
||||
|
||||
@@ -18,7 +18,7 @@ describe("jasmine.Matchers", function() {
|
||||
toFail: function() {
|
||||
return !lastResult().passed();
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
function match(value) {
|
||||
@@ -68,15 +68,15 @@ describe("jasmine.Matchers", function() {
|
||||
expect((match(['a', 'b']).toEqual(['a', jasmine.undefined]))).toFail();
|
||||
expect((match(['a', 'b']).toEqual(['a', 'b', jasmine.undefined]))).toFail();
|
||||
|
||||
expect((match(new String("cat")).toEqual("cat"))).toPass();
|
||||
expect((match(new String("cat")).toNotEqual("cat"))).toFail();
|
||||
expect((match("cat").toEqual("cat"))).toPass();
|
||||
expect((match("cat").toNotEqual("cat"))).toFail();
|
||||
|
||||
expect((match(new Number(5)).toEqual(5))).toPass();
|
||||
expect((match(new Number('5')).toEqual(5))).toPass();
|
||||
expect((match(new Number(5)).toNotEqual(5))).toFail();
|
||||
expect((match(new Number('5')).toNotEqual(5))).toFail();
|
||||
expect((match(5).toEqual(5))).toPass();
|
||||
expect((match(parseInt('5', 10)).toEqual(5))).toPass();
|
||||
expect((match(5).toNotEqual(5))).toFail();
|
||||
expect((match(parseInt('5', 10)).toNotEqual(5))).toFail();
|
||||
});
|
||||
|
||||
|
||||
it("toEqual with DOM nodes", function() {
|
||||
var nodeA = document.createElement('div');
|
||||
var nodeB = document.createElement('div');
|
||||
@@ -500,7 +500,7 @@ describe("jasmine.Matchers", function() {
|
||||
describe("and matcher is inverted with .not", function() {
|
||||
it("should match any exception", function() {
|
||||
expect(match(throwingFn).not.toThrow()).toFail();
|
||||
expect(lastResult().message).toMatch(/Expected function not to throw an exception/);
|
||||
expect(lastResult().message).toMatch(/Expected function not to throw an exception/);
|
||||
});
|
||||
|
||||
it("should match exceptions specified by message", function() {
|
||||
|
||||
@@ -18,9 +18,9 @@ describe("jasmine.MultiReporter", function() {
|
||||
delegate[methodName] = jasmine.createSpy(methodName);
|
||||
this.actual[methodName]("whatever argument");
|
||||
|
||||
return delegate[methodName].wasCalled
|
||||
&& delegate[methodName].mostRecentCall.args.length == 1
|
||||
&& delegate[methodName].mostRecentCall.args[0] == "whatever argument";
|
||||
return delegate[methodName].wasCalled &&
|
||||
delegate[methodName].mostRecentCall.args.length == 1 &&
|
||||
delegate[methodName].mostRecentCall.args[0] == "whatever argument";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('Spec', function () {
|
||||
|
||||
it('getFullName returns suite & spec description', function () {
|
||||
var spec = new jasmine.Spec(env, suite, 'spec 1');
|
||||
expect(spec.getFullName()).toEqual('suite 1 spec 1.')
|
||||
expect(spec.getFullName()).toEqual('suite 1 spec 1.');
|
||||
});
|
||||
|
||||
describe('results', function () {
|
||||
|
||||
@@ -25,7 +25,6 @@ describe("jasmine.util", function() {
|
||||
it("should return true if the argument is an array", function() {
|
||||
expect(jasmine.isArray_([])).toBe(true);
|
||||
expect(jasmine.isArray_(['a'])).toBe(true);
|
||||
expect(jasmine.isArray_(new Array())).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false if the argument is not an array", function() {
|
||||
|
||||
Reference in New Issue
Block a user