Skip to content

Commit

Permalink
Fix concurrent tests.
Browse files Browse the repository at this point in the history
Running jest runs the two test suites in parallel. If both try to run a server on port 3000, only one of them will succeed and supply files for both, however when that suite finishes first, it will take down the server and leave the other one hanging. Fix this by running the servers on different ports.
  • Loading branch information
cwalther committed Sep 23, 2019
1 parent d94a54d commit 425bd97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integration/widget.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ const express = require('express');

const puppeteer = require('puppeteer')

const rootUrl = "http://localhost:3000/";
const rootUrl = "http://localhost:3001/";

jest.setTimeout(500000);

const server = new Promise( resolve => {
let app = require( '../src/server' )({ directory: path.join( __dirname, '..' ) });
let server;
server = app.listen( 3000, () => resolve(server) );
server = app.listen( 3001, () => resolve(server) );
}).catch( e => console.log(e) );

const browser = puppeteer.launch({ headless: false });
Expand Down

0 comments on commit 425bd97

Please sign in to comment.