2016-01-08 17 views
5

İlgili: Can't set timeout for jasmineYasemin testim neden DEFAULT_TIMEOUT_INTERVAL öncesi zaman aşımına uğruyor?

Jasmine 2.4.1

Testim zaman aşımı değeri bildirilen zamandan daha büyük olması görünmesine rağmen, zaman aşımı nedeniyle arızalı olduğunu bildirir.

describe('tests content controller', function(){ 
    beforeAll(function(done) { 
     jasmine.DEFAULT_TIMEOUT_INTERVAL= 120000; 
     //... 
    }) 
    fit('/content GET should return 200',function(done){ 
     request(app) 
     .get('/content') 
     .set('Authorization', "bearer " + requestor.token) 
     .set('Accept', 'application/json') 
     .expect(200) 
     .end(function (err, res) { 
      console.log('timeout',jasmine.DEFAULT_TIMEOUT_INTERVAL); //prints 120000 
      if (err) done.fail(err); 
      expect(res.statusCode).toBe(200); 
      done(); 
     }) 
    }); 

Sonra bu test ile, başarısız: Bunu yapmamın

1) tests content controller /content GET should return 200 
    Message: 
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. 
    Stack: 
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. 
     at Timer.listOnTimeout [as ontimeout] (timers.js:110:15) 


Finished in 106.449 seconds 

106,449 saniye benim zaman aşımı değeri için ayarlanmış görünüyor şeydir az 120 saniye olduğundan .

Peki bu test neden başarısız oluyor?

+1

@engineer, getEnv() işlevini gerçekleştirirken, zaman aşımının vurulmaması için yazdırdığı 'console.log' neden olur. 'BeforeAll 'yerine' BeforeEach' değiştirilemedi – Houseman

cevap

2

Bu hataya neden olan beforeAll numaralı telefonun için done numaralı telefonu aramam.

İlgili konular