Skip to content

Commit

Permalink
Fixed the timeout issue with beforeEach/afterEach
Browse files Browse the repository at this point in the history
Resolves #240
  • Loading branch information
Chris Moultrie committed Jun 28, 2013
1 parent d537bc2 commit 6cf59e3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/jasmine-node/index.js
Expand Up @@ -84,6 +84,12 @@ jasmine.executeSpecsInFolder = function(options){
it = function(desc, func, timeout) {
return jasmine.getEnv().it(desc, func, timeout);
}
beforeEach = function(func, timeout) {
return jasmine.getEnv().beforeEach(func, timeout);
}
afterEach = function(func, timeout) {
return jasmine.getEnv().afterEach(func, timeout);
}
var fileMatcher = matcher || new RegExp(".(js)$", "i"),
colors = showColors || false,
specs = require('./spec-collection'),
Expand Down
18 changes: 18 additions & 0 deletions spec/TestSpec.js
Expand Up @@ -5,6 +5,24 @@ describe('jasmine-node-flat', function(){
});
});

describe('beforeEach Timeout', function(){
beforeEach(function(done) {
setTimeout(done, 1000);
}, 100);
it('should fail', function(){
expect(1+2).toEqual(3);
});
});

describe('afterEach Timeout', function(){
afterEach(function(done) {
setTimeout(done, 1000);
}, 100);
it('should pass and then afterEach will fail', function(){
expect(1+2).toEqual(3);
});
});

describe('Testing some characters', function() {
var chars = ['&', '\'', '"', '<', '>'];
for(var i = 0; i < chars.length; i+=1) {
Expand Down
6 changes: 3 additions & 3 deletions specs.sh
Expand Up @@ -6,22 +6,22 @@ echo "Running all tests located in the spec directory"
command=$entry"spec"
echo $command
time $command #/nested/uber-nested
echo -e "\033[1;35m--- Should have 57 tests and 101 assertions and 2 Failure. ---\033[0m"
echo -e "\033[1;35m--- Should have 59 tests and 104 assertions and 4 Failure. ---\033[0m"
echo ""

echo "Running all tests located in the spec directory with coffee option"
command=$entry"--coffee spec"
echo $command
time $command #/nested/uber-nested
echo -e "\033[1;35m--- Should have 62 tests and 106 assertions and 4 Failures. ---\033[0m"
echo -e "\033[1;35m--- Should have 64 tests and 109 assertions and 6 Failures. ---\033[0m"
echo ""

echo "Running all tests located in the spec directory with requirejs option"
#command=$entry"--nohelpers --runWithRequireJs spec-requirejs"
command=$entry"--runWithRequireJs spec"
echo $command
time $command
echo -e "\033[1;35m--- Should have 57 tests and 101 assertions and 2 Failure. ---\033[0m"
echo -e "\033[1;35m--- Should have 59 tests and 104 assertions and 4 Failure. ---\033[0m"
echo ""

echo "Running all tests located in the spec-requirejs directory with requirejs, requirejs setup, and coffee option"
Expand Down

0 comments on commit 6cf59e3

Please sign in to comment.