WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 8 months ago

#45863 closed defect (bug) (fixed)

Run core unit tests from src again

Reported by: atimmer Owned by: pento
Milestone: 5.1 Priority: normal
Severity: normal Version: 5.1
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

After [44359] we can run WordPress develop from src again, but the restriction for the tests is still in place. Let's get rid of that restriction.

Attachments (1)

45863.diff (1.3 KB) - added by atimmer 3 years ago.

Download all attachments as: .zip

Change History (14)

@atimmer
3 years ago

#1 @atimmer
3 years ago

@johnbillion @schlessera I am not 100% confident about this change, if you have time can you check if this patch makes sense?

#2 @netweb
3 years ago

I think it would be worthwhile maintaining the ability to run the tests from the build directory, including a Travis CI job running from the build directory using the ‘’built’’ source would be beneficial, even more so once E2E tests land.

#3 @atimmer
3 years ago

I think you can still run from build if you change the ABSPATH in wp-tests-config.php.

#4 @pbiron
3 years ago

Thank you! The patch works fine for me.

#5 @pento
3 years ago

  • Milestone changed from Awaiting Review to 5.1
  • Owner set to pento
  • Status changed from new to assigned

#6 @pento
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 44508:

Build/Tests: Default to running unit tests from src.

This commit also defaults WP-CLI commands to running against src, too.

Props atimmer, pento.
See #44492.
Fixes #45863.

#7 @pento
3 years ago

In 44509:

Build/Tests: Default to running unit tests from src.

This is the actual commit, unlike [44508], which was not.

Props atimmer.
See #44492.
Fixes #45863.

#8 @pento
3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#9 @pento
3 years ago

In 44512:

Tests: Revert [44509].

This commit causes Travis to fail.

See #45863.

#10 @pento
3 years ago

Travis is failing horribly, see this test output: https://travis-ci.org/WordPress/wordpress-develop/builds/477267171

@atimmer: Can you please investigate?

#11 @pento
3 years ago

In 44534:

Build/Tests: Allow running unit tests from src.

This is a partial recommit of [44509]: it allows running unit tests from src (which is useful), but doesn't make it the default (which Travis is having issues with).

See #45863.

#12 @atimmer
3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Thinking about this a bit more, I think we can close this now.

Locally, it is possible to run both from src and build. This fulfills the development desire.

Travis always runs from build, that is ok because the only tests where running from src or build matters are tests regarding assets. When testing from build we verify that the eventual assets in the build will be in a state that passes the unit tests.

#13 @johnbillion
8 months ago

In 50441:

Build/Test Tools: Switch back to running the PHPUnit test suite against the src directory instead of build.

Some PHPUnit tests were concerned with the state of files in the build directory. In order to allow the tests to run without requiring a build to be run first, these have been moved into assertions that run after the build step (and therefore cause it to fail if they do not pass), or into QUnit tests as necessary.

Various other PHPUnit tests implictly depend on built JavaScript files being present. These files are now touched during the test setup to avoid PHP warnings if the build files are not present.

The wp-tests-config-sample.php file and the GitHub Actions configuration have also been changed so ABSPATH uses src instead of build, therefore allowing the PHPUnit tests to be run without a build having to be run first. This means all new local installations of WordPress will use src for PHPUnit testing. If you would like to switch your existing installation over then change the location of ABSPATH in wp-tests-config.php to point to src instead of build.

Props peterwilsoncc, iandunn, gziolo, desroj, johnbillion

Fixes #51734
See #45863

Note: See TracTickets for help on using tickets.