mirror of
https://github.com/eggjs/egg.git
synced 2024-12-04 07:14:30 +00:00
test: fix development test (#546)
This commit is contained in:
parent
3d58bfd6a9
commit
da3c26a212
@ -5,7 +5,7 @@ const path = require('path');
|
||||
const request = require('supertest');
|
||||
const pedding = require('pedding');
|
||||
const mm = require('egg-mock');
|
||||
const should = require('should');
|
||||
const sleep = require('mz-modules/sleep');
|
||||
const utils = require('../../utils');
|
||||
|
||||
describe('test/lib/plugins/development.test.js', () => {
|
||||
@ -65,18 +65,16 @@ describe('test/lib/plugins/development.test.js', () => {
|
||||
fs.writeFileSync(filepath, body);
|
||||
});
|
||||
|
||||
it('should reload when file changed', done => {
|
||||
it('should reload when file changed', function* () {
|
||||
fs.writeFileSync(filepath, 'module.exports = function*() { this.body = \'change\'; };');
|
||||
// wait for app worker restart
|
||||
setTimeout(() => {
|
||||
request(app.callback())
|
||||
.get('/')
|
||||
.expect('change', err => {
|
||||
should.not.exist(err);
|
||||
app.expect('stdout', /App Worker#2:\d+ started/);
|
||||
done();
|
||||
});
|
||||
}, 3000);
|
||||
yield sleep(10000);
|
||||
|
||||
yield request(app.callback())
|
||||
.get('/')
|
||||
.expect('change');
|
||||
|
||||
app.expect('stdout', /App Worker#2:\d+ started/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user