Skip to content

Commit 3c9ed3d

Browse files
alan-agius4AndrewKushnir
authored andcommitted
test: make xvfb start and stop async (angular#64310)
The `xvfb.start()` and `xvfb.stop()` methods are asynchronous but were being called synchronously. This can lead to race conditions where the tests start running before the virtual frame buffer is fully initialized, or the process exits before it's fully stopped. This commit promisifies the `start` and `stop` methods to ensure they are properly awaited, making the e2e test setup more robust. PR Close angular#64310
1 parent ab98b24 commit 3c9ed3d

File tree

1 file changed

+4
-2
lines changed
  • vscode-ng-language-service/integration/e2e

1 file changed

+4
-2
lines changed

vscode-ng-language-service/integration/e2e/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {join} from 'node:path';
22
import {homedir, tmpdir} from 'node:os';
3+
import {promisify} from 'node:util';
34
import {runTests} from '@vscode/test-electron';
45

56
import {PACKAGE_ROOT, PROJECT_PATH} from '../test_constants';
@@ -17,7 +18,8 @@ async function main() {
1718
const vsCodeDataDir = await mkdtemp(join(tmpdir(), 'vscode-e2e-'));
1819

1920
try {
20-
xvfb.start();
21+
await promisify(xvfb.start).call(xvfb);
22+
2123
const exitCode = await runTests({
2224
// Keep version in sync with vscode engine version in package.json
2325
version: '1.74.3',
@@ -45,7 +47,7 @@ async function main() {
4547
console.error('Failed to run tests', err);
4648
process.exitCode = 1;
4749
} finally {
48-
xvfb.stop();
50+
await promisify(xvfb.stop).call(xvfb);
4951
}
5052
}
5153

0 commit comments

Comments
 (0)