Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp-env fix exec command in CI #50411

Merged
merged 2 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/env/lib/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
// Not all containers have the same starting working directory.
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',
Expand Down
6 changes: 3 additions & 3 deletions phpunit/class-override-script-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: in #49994, the function which injects wp-i18n was changed. According to @gziolo, this is expected:

I fixed [too many scripts loading] with 0cdab08. I'm not sure why that code was enforcing including wp-i18n as a dependency to all scripts coming from the Gutenberg plugin 🤷🏻

I replicated the logic from WordPress core that resolves the issue and ensures that translations still work where applicable

Since the phpunit tests were not running correctly, it makes sense that the phpunit tests were not updated in that PR

}

/**
Expand All @@ -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 );
}
Expand All @@ -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 );
}
Expand Down