2017-06-23 17 views
0

このテストでは問題があります。挿入作業の理由私は知らないが、私は、テストを実行する場合、私は受け取る:タイムアウトを超えましたMocha + Sequelize

Error: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

CODE

describe('CRUD on Product', function() { 
    this.timeout(15000) 
    it('Insert single Product', function (done) { 
    Product.build({ 
     Customer: customer, 
     Order: order 
    }, { 
     include: [Customer, Order] 
    }).save(function (mind) { 
     console.log(mind) 
     done(); 
    }).catch(function(err){ 
     console.log(err) 
     done() 
    }) 
    }); 
}); 

答えて

1

を示すように、このtutorialで、save関数としてコールバックを取ることはありません。パラメータ。 promiseを返します。

describe('CRUD on Product', function() { 
    this.timeout(15000) 
    it('Insert single Product', function (done) { 
    Product.build({ 
     Customer: customer, 
     Order: order 
    }, { 
     include: [Customer, Order] 
    }) 
    .save() 
    .then(function (mind) { 
     console.log(mind) 
     done(); 
    }) 
    .catch(function(err){ 
     console.log(err) 
     done() 
    }) 
    }); 
}); 
関連する問題