Skip to content

Commit 8385072

Browse files
committed
Wait until dev server is ready
1 parent 50ef125 commit 8385072

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

test/Client.test.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,30 @@ function startProxy(port) {
2626
}
2727

2828
describe('Client code', () => {
29-
let proxy;
3029
let server;
3130

3231
beforeAll((done) => {
3332
server = runDevServer('--host 0.0.0.0 --port 8080', configPath);
34-
proxy = startProxy(9090);
3533
setTimeout(done, 5000);
3634
});
3735

38-
afterAll((done) => {
39-
proxy.close();
36+
afterAll(() => {
4037
server.close();
41-
done();
4238
});
4339

4440
describe('behind a proxy', () => {
41+
let proxy;
42+
4543
jest.setTimeout(20000);
4644

45+
beforeAll(() => {
46+
proxy = startProxy(9090);
47+
});
48+
49+
afterAll(() => {
50+
proxy.close();
51+
});
52+
4753
it('responds with a 200', (done) => {
4854
const req = request('http://localhost:9090');
4955
req.get('/sockjs-node').expect(200, 'Welcome to SockJS!\n', done);

0 commit comments

Comments
 (0)