Skip to content

Commit

Permalink
Leaner, healthier development - no cake, no build
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanboktae committed Dec 22, 2013
1 parent bd949b7 commit edb4cc4
Show file tree
Hide file tree
Showing 27 changed files with 205 additions and 867 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -3,4 +3,4 @@ node_js:
- 0.10
before_script:
- phantomjs --version
script: cake test
script: npm test
41 changes: 0 additions & 41 deletions Cakefile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -163,7 +163,7 @@ Also, no compilers are supported currently, so please provide JavaScript only fo

# Testing

Simple! Just clone the repo, then run `npm install` and the various node development dependencies will install to the `node_modules` directory of the project. If you have not done so, it is typically a good idea to add `/node_modules/.bin` to your `$PATH` so these modules bins are used. Now run `cake test` to start off the test suite.
Simple! Just clone the repo, then run `npm install` and the various node development dependencies will install to the `node_modules` directory of the project. If you have not done so, it is typically a good idea to add `/node_modules/.bin` to your `$PATH` so these modules bins are used. Now run `npm test` to start off the test suite.

We also use Travis CI to run our tests too. The current build status:

Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -25,7 +25,7 @@
"mocha-phantomjs" : "./bin/mocha-phantomjs"
},
"scripts" : {
"test" : "cake test"
"test" : "mocha --compilers coffee:coffee-script test/mocha-phantomjs.coffee -t 20000 -R spec"
},
"dependencies" : {
"mocha" : "1.13.x",
Expand All @@ -34,7 +34,6 @@
},
"devDependencies" : {
"chai" : "1.8.x",
"async" : "0.2.x",
"coffee-script" : "1.6.x",
"requirejs" : "2.1.x"
}
Expand Down
File renamed without changes.
File renamed without changes.
28 changes: 24 additions & 4 deletions test/iframe.html
Expand Up @@ -8,12 +8,32 @@
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>

<script>
mocha.ui('bdd');
mocha.reporter('html');
expect = chai.expect;
mocha.ui('bdd');

describe('<iframe>', function() {
it('allow us to remove an iframe that is not finished downloading', function() {
var iframe = document.createElement("iframe");
iframe.src = "blank.html";
document.body.appendChild(iframe);
iframe.parentNode.removeChild(iframe);
});

it('allow us to destroy an iframe reference that is not finished downloading', function() {
var iframe = document.createElement("iframe");
iframe.src = "blank.html";
iframe = null;
});

it('allow us to change the src of an iframe that is not finished downloading', function() {
var iframe = document.createElement("iframe");
iframe.src = "blank.html";
iframe.src = "about:blank";
});
});
</script>
<script src="lib/iframe.js"></script>

<script>
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
Expand Down
69 changes: 30 additions & 39 deletions test/lib/failing-async.js
@@ -1,43 +1,34 @@
// Generated by CoffeeScript 1.6.3
(function() {
var expect;
expect = (chai && chai.expect) || require('chai').expect;

expect = (typeof chai !== "undefined" && chai !== null ? chai.expect : void 0) || require('chai').expect;
describe('Async Tests Failing', function() {
it('passes 1', function() {
expect(1).to.be.ok;
});
it('passes 2', function() {
expect(2).to.be.ok;
});
it('passes 3', function() {
expect(3).to.be.ok;
});

describe('Async Tests Failing', function() {
it('passes 1', function() {
return expect(1).to.be.ok;
});
it('passes 2', function() {
return expect(2).to.be.ok;
});
it('passes 3', function() {
return expect(3).to.be.ok;
});
it('fails 1', function(done) {
var test;
test = function() {
expect(false).to.be["true"];
return done();
};
return setTimeout(test, 0);
});
it('fails 2', function(done) {
var test;
test = function() {
expect(false).to.be["true"];
return done();
};
return setTimeout(test, 0);
});
return it('fails 3', function(done) {
var test;
test = function() {
expect('false').to.equal('true');
return done();
};
return setTimeout(test, 0);
});
it('fails 1', function(done) {
setTimeout(function() {
expect(false).to.be.true;
done();
}, 0);
});

}).call(this);
it('fails 2', function(done) {
setTimeout(function() {
expect(false).to.be.true;
done();
}, 0);
});

it('fails 3', function(done) {
setTimeout(function() {
expect('false').to.equal('true');
done();
}, 0);
});
});
47 changes: 23 additions & 24 deletions test/lib/failing.js
@@ -1,28 +1,27 @@
// Generated by CoffeeScript 1.6.3
(function() {
var expect;
expect = (chai && chai.expect) || require('chai').expect;

expect = (typeof chai !== "undefined" && chai !== null ? chai.expect : void 0) || require('chai').expect;
describe('Tests Failing', function() {
it('passes 1', function() {
expect(1).to.be.ok;
});

it('passes 2', function() {
expect(2).to.be.ok;
});

it('passes 3', function() {
expect(3).to.be.ok;
});

it('fails 1', function() {
expect(false).to.be["true"];
});

describe('Tests Failing', function() {
it('passes 1', function() {
return expect(1).to.be.ok;
});
it('passes 2', function() {
return expect(2).to.be.ok;
});
it('passes 3', function() {
return expect(3).to.be.ok;
});
it('fails 1', function() {
return expect(false).to.be["true"];
});
it('fails 2', function() {
return expect(false).to.be["true"];
});
return it('fails 3', function() {
return expect('false').to.equal('true');
});
it('fails 2', function() {
expect(false).to.be["true"];
});

}).call(this);
it('fails 3', function() {
expect('false').to.equal('true');
});
});
25 changes: 0 additions & 25 deletions test/lib/iframe.js

This file was deleted.

43 changes: 17 additions & 26 deletions test/lib/many.js
@@ -1,28 +1,19 @@
// Generated by CoffeeScript 1.6.3
(function() {
var expect;
expect = (chai && chai.expect) || require('chai').expect;

expect = (typeof chai !== "undefined" && chai !== null ? chai.expect : void 0) || require('chai').expect;

describe('Many Tests', function() {
var fail, n, skip, _i, _results;
_results = [];
for (n = _i = 1; _i <= 500; n = ++_i) {
skip = n % 10 === 0;
fail = n % 100 === 0;
if (fail) {
_results.push(it("fails " + n, function() {
return expect(false).to.be["true"];
}));
} else if (skip) {
_results.push(it.skip("skips " + n, function() {}));
} else {
_results.push(it("passes " + n, function() {
return expect(n).to.equal(n);
}));
}
describe('Many Tests', function() {
for (var n = 1; n <= 500; n++) {
if (n % 10 === 0) {
xit('skips ' + n, function() {
expect(false).to.be.true
})
} else if (n % 100 === 2) {
it('fails ' + n, function() {
expect(false).to.be.true
})
} else {
it('passses ' + n, function() {
expect(n).to.equal(n)
})
}
return _results;
});

}).call(this);
}
});

1 comment on commit edb4cc4

@metaskills
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love CoffeeScript, but I also think this is cleaner. I really liked how it removes the whole notion of a src directory and I really liked how you implemented the npm test. So 👍 is my vote.

Please sign in to comment.