fix(testing): use correct server process reference when killing the server in the cypress preset (#30994)

## Current Behavior

Cypress e2e tasks fail when trying to kill the web server with:

```bash
TypeError: Cannot read properties of undefined (reading 'childProcess')
    at /<repo path>/node_modules/@nx/cypress/plugins/cypress-preset.js:65:30
    ...
```

## Expected Behavior

Cypress e2e tasks should not fail when trying to kill the web server.

## Related Issue(s)

Fixes #
This commit is contained in:
Leosvel Pérez Espinosa 2025-05-02 12:43:03 +02:00 committed by GitHub
parent 51168a7c38
commit 80e6edd707
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,7 +94,7 @@ function startWebServer(webServerCommand: string) {
} else {
return new Promise<void>((res, rej) => {
if (process.platform === 'win32' || process.platform === 'darwin') {
if (this.childProcess.kill()) {
if (serverProcess.kill()) {
res();
} else {
rej('Unable to kill process');