wp-cli-tests
wp-cli-tests copied to clipboard
Run tests against Windows
To help prevent regressions like https://github.com/wp-cli/wp-cli/issues/5521, it would be nice to run our test suites against Windows.
Done is:
- Our automated tests are running against Windows in all repos.
As part of the nightly testing of the mentioned issue I've run the test suite on Windows which fail with the following error.
1) Extractor_Test::test_extract_tarball
Failed asserting that 1 is identical to 0.
wp-cli\tests\test-extractor.php:119
Tracing the error I find this.
tar: Option --force-local is not supported
Removing the ( Utils\is_windows() ? ' --force-local' : '' )
part of tar
command within \Extractor_Test::test_extract_tarball
makes all tests pass.
OK, but incomplete, skipped, or risky tests!
Tests: 270, Assertions: 722, Risky: 1.
I tested on Windows 10 against:
- PHP 7.4
- PHP 8.0
- PHP 8.1
Removing the
( Utils\is_windows() ? ' --force-local' : '' )
part oftar
command within\Extractor_Test::test_extract_tarball
makes all tests pass.
Looks like that was added ~5 years ago: https://github.com/wp-cli/wp-cli/commit/271cd752f4bbd055bacbac3da01ca080d8b9363f#diff-ce006bf8351a3174bac26fef9078e893523d313ace23732b67ad97942e7b2ec4R115-R116
It was included in the same PR as the original issue: https://github.com/wp-cli/wp-cli/pull/4572
My guess is that @gitlost fixed some "earlier versions of PHP on Windows" issue that no longer exists. I don't know what the particular issue was or when it was resolved, though.
Pardon my extremely naive question but... which versions of Windows should we support?
Great question... I believe the following are probably a reasonable place to start.
- Windows 10
- Windows 11
- Windows Server 2019
- Windows Server 2022
No harm running tests against MacOS either, if it's easy to add to the matrix. I've had to fix differences in tar and sed. ...it's not unlikely that those same issues will reoccur under Windows. Unfortunately I don't have a regular Windows environment to test in (currently searching to see is Azure a tool I could use).