From de6c8a079560d50193e6f7bb73fce15dc22621c0 Mon Sep 17 00:00:00 2001 From: Noah Allen Date: Fri, 5 May 2023 18:24:50 -0700 Subject: [PATCH 1/2] Fix exec command in CI Use -T instead of --no-TTY. The latter doesn't work. Fix unit test that was failing on trunk. --- packages/env/lib/commands/run.js | 10 ++++++++-- phpunit/class-override-script-test.php | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/env/lib/commands/run.js b/packages/env/lib/commands/run.js index 1e13f7a797c38a..490603047bc1c3 100644 --- a/packages/env/lib/commands/run.js +++ b/packages/env/lib/commands/run.js @@ -61,14 +61,20 @@ function spawnCommandDirectly( config, container, command, envCwd, spinner ) { const hostUser = getHostUser(); // We need to pass absolute paths to the container. - envCwd = path.resolve( '/var/www/html', envCwd ); + envCwd = path.resolve( + // Note: mysql doesn't have the /var/www/html construct. + container === 'mysql' || container === 'tests-mysql' + ? '/' + : '/var/www/html', + envCwd + ); const isTTY = process.stdout.isTTY; const composeCommand = [ '-f', config.dockerComposeConfigPath, 'exec', - ! isTTY ? '--no-TTY' : '', + ! isTTY ? '-T' : '', '-w', envCwd, '--user', diff --git a/phpunit/class-override-script-test.php b/phpunit/class-override-script-test.php index b3af1acd80f446..0bc3bc5853ae1e 100644 --- a/phpunit/class-override-script-test.php +++ b/phpunit/class-override-script-test.php @@ -40,7 +40,7 @@ public function test_localizes_script() { ); $script = $wp_scripts->query( 'gutenberg-dummy-script', 'registered' ); - $this->assertEquals( array( 'dependency', 'wp-i18n' ), $script->deps ); + $this->assertEquals( array( 'dependency' ), $script->deps ); } /** @@ -60,7 +60,7 @@ public function test_replaces_registered_properties() { $script = $wp_scripts->query( 'gutenberg-dummy-script', 'registered' ); $this->assertEquals( 'https://example.com/updated', $script->src ); - $this->assertEquals( array( 'updated-dependency', 'wp-i18n' ), $script->deps ); + $this->assertEquals( array( 'updated-dependency' ), $script->deps ); $this->assertEquals( 'updated-version', $script->ver ); $this->assertSame( 1, $script->args ); } @@ -82,7 +82,7 @@ public function test_registers_new_script() { $script = $wp_scripts->query( 'gutenberg-second-dummy-script', 'registered' ); $this->assertEquals( 'https://example.com/', $script->src ); - $this->assertEquals( array( 'dependency', 'wp-i18n' ), $script->deps ); + $this->assertEquals( array( 'dependency' ), $script->deps ); $this->assertEquals( 'version', $script->ver ); $this->assertSame( 1, $script->args ); } From 40fcd15f3965664fc03b29795ce3e6ebc2245b9a Mon Sep 17 00:00:00 2001 From: Noah Allen Date: Fri, 5 May 2023 18:31:17 -0700 Subject: [PATCH 2/2] update comment --- packages/env/lib/commands/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/env/lib/commands/run.js b/packages/env/lib/commands/run.js index 490603047bc1c3..e949d81814b15f 100644 --- a/packages/env/lib/commands/run.js +++ b/packages/env/lib/commands/run.js @@ -62,7 +62,7 @@ function spawnCommandDirectly( config, container, command, envCwd, spinner ) { // We need to pass absolute paths to the container. envCwd = path.resolve( - // Note: mysql doesn't have the /var/www/html construct. + // Not all containers have the same starting working directory. container === 'mysql' || container === 'tests-mysql' ? '/' : '/var/www/html',