Properly shutdown testing http server

It turned out that server.close() does not shutdown server but
stops it from accepting *new* connections.

It's our responsibility to destroy all the current connections,
if any.
This commit is contained in:
Andrey Lushnikov
2017-07-07 08:55:30 -07:00
parent 83b8af6987
commit 18b2a46a83
2 changed files with 22 additions and 6 deletions

View File

@@ -36,10 +36,10 @@ describe('Puppeteer', function() {
GoldenUtils.removeOutputDir();
}));
afterAll(function() {
server.stop();
afterAll(SX(async function() {
await server.stop();
browser.close();
});
}));
beforeEach(SX(async function() {
page = await browser.newPage();
@@ -105,7 +105,7 @@ describe('Puppeteer', function() {
});
describe('Page.injectFile', function() {
it('should fail when navigating to bad url', SX(async function() {
it('should work', SX(async function() {
const helloPath = path.join(__dirname, './assets/injectedfile.js');
await page.injectFile(helloPath);
const result = await page.evaluate(() => __injected);