Skip to content

fix(js-tests): fix test isolation bugs exposed by Jasmine 5 random ordering - #41616

Merged
DeepDiver1975 merged 2 commits into
masterfrom
fix/js-test-isolation-jasmine5
Jun 11, 2026
Merged

fix(js-tests): fix test isolation bugs exposed by Jasmine 5 random ordering#41616
DeepDiver1975 merged 2 commits into
masterfrom
fix/js-test-isolation-jasmine5

Conversation

@DeepDiver1975

Copy link
Copy Markdown
Member

Summary

  • fileactionsmenuSpec.js: Call OC.hideMenus() in afterEach to clear OC._currentMenu before menu.remove(), preventing a double slideUp in subsequent tests
  • files_sharing/appSpec.js: Save and restore OCA.Files.fileActions in the file actions describe so stale _onActionsUpdated handlers from files/appSpec.js don't fire with fileList=null causing infinite recursion
  • systemtagsinfoviewSpec.js: Reset allTagsCollection (the OC.SystemTags.collection singleton) in beforeEach/afterEach of the events describe so name mutations (e.g. set('name', 'test1_renamed')) don't persist into other test suites
  • systemtagsinputfieldSpec.js: Call view.collection.reset() in both the as admin and as user initSelection beforeEach blocks so Backbone's silent ignore of duplicate-id add() calls doesn't leave stale/renamed models in the singleton

Root cause

Jasmine 5 (bumped in #41615) runs tests in random order by default. This exposed pre-existing test isolation bugs where shared singleton state (OC._currentMenu, OCA.Files.fileActions, OC.SystemTags.collection) was left dirty between tests.

Test plan

  • Verified with 25 consecutive successful karma runs under Jasmine 5 random ordering (FirefoxHeadless)

🤖 Generated with Claude Code

…dering

Jasmine 5 runs tests in random order by default, which exposed several
pre-existing test isolation bugs where shared singleton state was left
dirty between tests.

Fixes:
- fileactionsmenuSpec.js: call OC.hideMenus() in afterEach to clear
  OC._currentMenu before calling menu.remove(), preventing a stale
  reference from triggering a double slideUp in subsequent tests

- files_sharing/appSpec.js: save and restore OCA.Files.fileActions in
  the 'file actions' describe's beforeEach/afterEach so that stale
  _onActionsUpdated handlers registered by OCA.Files.App (in files/appSpec.js)
  don't fire with fileList=null and cause infinite recursion

- systemtagsinfoviewSpec.js: reset allTagsCollection (OC.SystemTags.collection
  singleton) in beforeEach and afterEach of the 'events' describe, so that
  model mutations (e.g. set('name', 'test1_renamed')) don't persist into
  subsequent test suites

- systemtagsinputfieldSpec.js: call view.collection.reset() in both the
  'as admin' and 'as user' initSelection beforeEach blocks so that stale
  models with matching ids from prior tests are cleared before adding
  fresh testTags (Backbone.add silently ignores duplicate-id models)

All fixes verified with 25 consecutive successful karma runs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@update-docs

update-docs Bot commented Jun 11, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

DeepDiver1975 added a commit that referenced this pull request Jun 11, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@DeepDiver1975
DeepDiver1975 force-pushed the fix/js-test-isolation-jasmine5 branch from 7c0ca89 to 77922f5 Compare June 11, 2026 16:28
@DeepDiver1975
DeepDiver1975 merged commit ee33fff into master Jun 11, 2026
26 checks passed
@DeepDiver1975
DeepDiver1975 deleted the fix/js-test-isolation-jasmine5 branch June 11, 2026 19:11
This was referenced Jun 11, 2026
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