1 import { execSync } from 'child_process';
2 import { commandAsWebserver } from '../globals';
5 * Uninstalls a test Drupal site.
7 * @param {function} callback
8 * A callback which will be called, when the uninstallation is finished.
10 * The 'browser' object.
12 exports.command = function drupalUninstal(callback) {
14 const prefix = self.drupalDbPrefix;
16 // Check for any existing errors, because running this will cause Nightwatch to hang.
17 if (!this.currentTest.results.errors && !this.currentTest.results.failed) {
19 process.env.DRUPAL_TEST_DB_URL.length > 0
20 ? `--db-url ${process.env.DRUPAL_TEST_DB_URL}`
23 if (!prefix || !prefix.length) {
25 'Missing database prefix parameter, unable to uninstall Drupal (the initial install was probably unsuccessful).',
30 `php ./scripts/test-site.php tear-down ${prefix} ${dbOption}`,
34 this.assert.fail(error);
38 // Nightwatch doesn't like it when no actions are added in a command file.
39 // https://github.com/nightwatchjs/nightwatch/issues/1792
42 if (typeof callback === 'function') {