Skip to content

Commit

Permalink
@wordpress/env: Fix testsPath on local sources (#20353)
Browse files Browse the repository at this point in the history
* @wordpress/env: Fix testsPath on local sources

When using a local source (e.g. ~/path/to/wordpress), the tests
WordPress directory should be at ~/.wp-env/$hash/tests-wordpress instead
of ~/path/to/tests-wordpress.

* @wordpress/env: Show debug output from docker-compose stop in wp-env start
  • Loading branch information
noisysocks authored and jorgefilipecosta committed Mar 2, 2020
1 parent ead3acf commit 94913f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/env/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ module.exports = {
coreSource: includeTestsPath(
parseSourceString( config.core, {
workDirectoryPath,
} )
} ),
{ workDirectoryPath }
),
pluginSources: config.plugins.map( ( sourceString ) =>
parseSourceString( sourceString, {
Expand Down Expand Up @@ -277,18 +278,19 @@ function parseSourceString( sourceString, { workDirectoryPath } ) {
* property set correctly. Only the 'core' source requires a testsPath.
*
* @param {Source|null} source A source object.
* @param {Object} options
* @param {string} options.workDirectoryPath Path to the work directory located in ~/.wp-env.
* @return {Source|null} A source object.
*/
function includeTestsPath( source ) {
function includeTestsPath( source, { workDirectoryPath } ) {
if ( source === null ) {
return null;
}

return {
...source,
testsPath: path.resolve(
source.path,
'..',
workDirectoryPath,
'tests-' + path.basename( source.path )
),
};
Expand Down
2 changes: 1 addition & 1 deletion packages/env/lib/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
*
* @see https://github.com/WordPress/gutenberg/pull/20253#issuecomment-587228440
*/
await module.exports.stop( { spinner } );
await module.exports.stop( { spinner, debug } );

await checkForLegacyInstall( spinner );
const config = await initConfig( { spinner, debug } );
Expand Down

0 comments on commit 94913f7

Please sign in to comment.