Skip to content

Commit

Permalink
fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-guggisberg committed Apr 13, 2023
1 parent 6c521c5 commit 6178c5a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import { randomBytes } from 'crypto';
import { readFile } from 'fs/promises';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { promisify } from 'util';

const randomBuffer = promisify(randomBytes);

// Workaround for ES6 which doesn't support the NodeJS global __dirname
const __dirname = dirname(fileURLToPath(import.meta.url));
Expand Down Expand Up @@ -85,7 +88,7 @@ class Server {
'Content-Type': 'application/octet-stream',
'Content-Length': `${count}`,
});
res.end(randomBytes(count));
res.end(await randomBuffer(count));
break;

default:
Expand Down

0 comments on commit 6178c5a

Please sign in to comment.