Permalink
Browse files

Fixed the timeout issue with beforeEach/afterEach

Resolves #240
  • Loading branch information...
1 parent d537bc2 commit 6cf59e334eeef522d9c4e2af483e8d1533e8e14c @tebriel tebriel committed Jun 28, 2013
Showing with 27 additions and 3 deletions.
  1. +6 −0 lib/jasmine-node/index.js
  2. +18 −0 spec/TestSpec.js
  3. +3 −3 specs.sh
@@ -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'),
View
@@ -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) {
View
@@ -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"

0 comments on commit 6cf59e3

Please sign in to comment.