Skip to content

Commit

Permalink
Merge pull request #725 from johanneswuerbach/lazy-mocha-test
Browse files Browse the repository at this point in the history
Lazy mocha test
  • Loading branch information
johanneswuerbach committed Jan 4, 2016
2 parents 19d9bcb + cb1e0a2 commit 3c4120b
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 2 deletions.
3 changes: 3 additions & 0 deletions examples/mocha_lazy/hello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function hello(name){
return "hello " + (name || 'world');
}
10 changes: 10 additions & 0 deletions examples/mocha_lazy/hello_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var expect = chai.expect;

describe('hello', function(){
it('should say hello', function(){
expect(hello()).to.equal('hello world');
});
it('should say hello to person', function(){
expect(hello('Bob')).to.equal('hello Bob');
});
});
20 changes: 20 additions & 0 deletions examples/mocha_lazy/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!doctype html>
<html>
<head>
<title>Test'em</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script src="/testem.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/chai/3.4.1/chai.js"></script>
<script>mocha.setup('bdd')</script>
<script src="hello.js"></script>
<script src="hello_spec.js"></script>
<script>
Testem.hookIntoTestFramework();
mocha.run()
</script>
</body>
</html>
7 changes: 7 additions & 0 deletions examples/mocha_lazy/testem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"framework": "mocha",
"test_page": "test.html",
"src_files": [
"*.js"
]
}
4 changes: 4 additions & 0 deletions tests/examples/examples_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ describe('examples', function() {
testExample(path.join('examples/mocha_simple'), done);
});

it('runs lazy mocha', function(done) {
testExample(path.join('examples/mocha_lazy'), done);
});

it('runs qunit', function(done) {
testExample(path.join('examples/qunit_simple'), done);
});
Expand Down
2 changes: 1 addition & 1 deletion views/mochachairunner.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>Test'em</title>
<link rel="stylesheet" href="//cdjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/chai/3.4.1/chai.js"></script>
<script src="/testem.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion views/mocharunner.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>Test'em</title>
<link rel="stylesheet" href="//cdjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/mocha/2.3.4/mocha.js"></script>
<script src="/testem.js"></script>
<script>mocha.setup('bdd')</script>
Expand Down

0 comments on commit 3c4120b

Please sign in to comment.