Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sauercrowd committed Sep 14, 2024
1 parent bf28766 commit 2e20d42
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions test/varwind.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ describe('Varwind Library Tests', () => {
let port;

beforeAll(async () => {
server = spawn('npx', ['http-server', '-p', '0', '.'], { shell: true });

// Extract the port from the server output
await new Promise((resolve) => {
server.stdout.on('data', (data) => {
const match = data.toString().match(/Available on:\s+http:\/\/127\.0\.0\.1:(\d+)/);
if (match) {
port = match[1];
resolve();
}
});
});

server = spawn('npx', ['http-server', '-p', '8080', '.'], { shell: true });

port = 8080;
await new Promise((resolve) => setTimeout(resolve, 1000));
//// Extract the port from the server output
//await new Promise((resolve) => {
// server.stdout.on('data', (data) => {
// const match = data.toString().match(/Available on:\s+http:\/\/127\.0\.0\.1:(\d+)/);
// if (match) {
// port = match[1];
// resolve();
// }
// });
//});


await waitOn({ resources: [`http://localhost:${port}`] });
Expand Down

0 comments on commit 2e20d42

Please sign in to comment.