Skip to content

Clean up test extraction folders in tear_down - #136

Merged
erseco merged 1 commit into
mainfrom
hotfix/test-isolation
Sep 26, 2026
Merged

erseco merged 1 commit into
mainfrom
hotfix/test-isolation

Conversation

@erseco

@erseco erseco commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

First of a stack of eight small PRs from a modernization/security pass. Each PR targets the previous branch; merge them in order.

Problem

ElpUploadHandlerTest::test_delete_extracted_folder_nonexistent_dir failed intermittently on full-suite runs and passed when run alone.

Several tests create uploads/exelearning/{hash}/ fixtures with fixed hashes (ffff…, aaaa…, cccc…, 7777…). They remove the fixtures inline, after the assertions, or not at all. The wp-env uploads directory persists across runs, so an aborted or failing run left, for example, ffff…f/ behind (from RestApiTest::test_save_elp_file_cleanup_with_old_extraction). That broke the precondition of the handler test on the next run.

Change

  • ElpUploadHandlerTest, RestApiTest and ShortcodesTest register every fixture path and delete it in tear_down(). This is the pattern StaleContentRedirectTest already uses, with ExeLearning_Styles_Service::recursive_delete().
  • The "missing folder" test uses a unique hash, so no other test can collide with it.

Tests only; no runtime change.

Verification

  • ffff…f/index.html was seeded by hand in the tests container. The full suite then ran green twice in a row: OK (943 tests, 2074 assertions).
  • No uploads/exelearning/ leftovers after the runs.

Stack

  1. Clean up test extraction folders in tear_down #136 Clean up test extraction folders in tear_down
  2. Apply the style package allowlist to nested entries #137 Apply the style package allowlist to nested entries (security)
  3. Check who sends postMessage to the editor modal and bridge #138 Check who sends postMessage to the editor modal and bridge (security)
  4. Harden the release workflows against injected values #139 Harden the release workflows against injected values
  5. Keep make up working with a dirty editor clone or no network #140 Keep make up working with a dirty editor clone or no network
  6. Share one recursive delete and validate hashes before deleting #141 Share one recursive delete and validate hashes before deleting
  7. Remove unreachable scaffolding and clean options on uninstall #142 Remove unreachable scaffolding and clean options on uninstall
  8. Make AGENTS.md the single agent guide and import it from CLAUDE.md #143 Bring CLAUDE.md and AGENTS.md in line with the code

Tests created uploads/exelearning/{hash}/ fixtures with fixed hashes and
removed them inline, after assertions. A run that failed or was aborted
mid-test left the folder in the persistent wp-env uploads directory, so
ElpUploadHandlerTest::test_delete_extracted_folder_nonexistent_dir failed on
the next full-suite run. Register every fixture path for tear_down cleanup and
give the 'missing folder' test a unique hash.
@github-actions

Copy link
Copy Markdown
Contributor

Test in WordPress Playground

Test the plugin with the code from this branch:

Preview in WordPress Playground

ℹ️ The eXeLearning editor is fetched from the shared release and unpacked into the plugin when the playground boots, so the first load may take a few extra seconds. ELP upload, shortcode, Gutenberg block and preview work normally.

@codecov-commenter

codecov-commenter commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.87%. Comparing base (3410936) to head (704e330).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #136   +/-   ##
=========================================
  Coverage     96.87%   96.87%           
  Complexity      864      864           
=========================================
  Files            39       39           
  Lines          4323     4323           
=========================================
  Hits           4188     4188           
  Misses          135      135           
Flag Coverage Δ
javascript 95.70% <ø> (ø)
php 97.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erseco
erseco added this pull request to stack #144 September 26, 2026 07:38
@erseco
erseco merged commit 78c245d into main Sep 26, 2026
5 checks passed
@erseco
erseco deleted the hotfix/test-isolation branch September 26, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants