No error output in Nightwatch if the ./scripts/test-site.php produces the "Parse error"

Created on 11 November 2024, about 1 month ago

Problem/Motivation

If your testing module produces the "Parse error" on the Drupal install stage, sometimes you don't see this error text in the Nightwatch output.

Steps to reproduce

1. Run a Nightwatch test from Core, eg this one:

yarn test:nightwatch /var/www/html/web/core/tests/Drupal/Nightwatch/Tests/loginTest.js

See that it executes well.

2. Open the file modules/user/src/UserFloodControl.php and make a syntax error there, eg like this:

class UserFloodControl implements UserFloodControlInterface {
asdsad  
  /**

3. Run the Nightwatch test again, and see that Drupal fails to install, but with no error output:

$ yarn test:nightwatch /var/www/html/web/core/tests/Drupal/Nightwatch/Tests/loginTest.js
yarn run v1.22.22
$ node -r dotenv-safe/config ./node_modules/.bin/nightwatch --config ./tests/Drupal/Nightwatch/nightwatch.conf.js /var/www/html/web/core/tests/Drupal/Nightwatch/Tests/loginTest.js

[Tests/Login Test] Test Suite
──────────────────────────────────────────────────────────
ℹ Connected to selenium-chrome on port 4444 (364ms).
  Using: chrome (129.0.6668.100) on LINUX.

  ✖ NightwatchAssertError
   Command failed: php ./scripts/test-site.php install  --install-profile "nightwatch_testing"  --base-url http://web --db-url mysql://db:db@db/db --json


  Running Test login:

4. Run the install command manually in the console and see the actual error text:

$ php ./scripts/test-site.php install  --install-profile "nightwatch_testing"  --base-url http://web --db-url mysql://db:db@db/db --json
Xdebug: [Step Debug] Could not connect to debugging client. Tried: 127.0.0.1:9003 (fallback through xdebug.client_host/xdebug.client_port).

Parse error: syntax error, unexpected identifier "asdsad", expecting "function" or "const" in /var/www/html/web/core/modules/user/src/UserFloodControl.php on line 17

This happens because for some reason PHP outputs the error to stdout instead of the stderr.

Proposed resolution

When Drupal fails to install, output the stdout to the console as well.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

javascript

Created by

🇦🇲Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024