2
我有這樣一個規範的web應用程序:Mocha - 哪個或哪個之前運行?
describe('Hook them up',() => {
var server;
beforeEach(done => {
server = app.listen(done);
});
before(done => {
// Does this run before or after "beforeEach"
// If I try to access the api at this point I get an ECONNREFUSED
});
after(done => {
server.close(done);
});
it('should set the \'createdAt\' property for \'DndUsers\' objects', done => {
api.post('/api/tweets')
.send({ text: 'Hello World' })
.then(done)
.catch(err => {
console.log(err);
done();
});
});
});
在我的一些其他項目,如果我嘗試訪問API中的before
塊它工作正常,好像beforeEach
已經運行。