Conversation
The v4.1.0 > v4.2.0 mutates ("add item _isPartlyCorrect", "add item
_score") and the v7.3.11 > v7.4.0 mutate ("add altText to _items")
accessed MCQ._items.forEach(...) with no guard, throwing
"TypeError: Cannot read properties of undefined (reading 'forEach')"
for an mcq with no _items. The v4.2.0 testSuccessWhere (itemless mcq)
already failed because of this.
Use MCQ._items?.forEach(...) in the mutates and (MCQ._items ?? []).every(...)
in the matching checks so an absent _items array is handled gracefully.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Closing this. On review, the failure originates from the migration's own |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #263
Fix
v4.1.0 > v4.2.0mutates ("add item_isPartlyCorrect", "add item_score") and thev7.3.11 > v7.4.0mutate ("addaltTextto_items") accessedMCQ._items.forEach(...)directly, throwingTypeError: Cannot read properties of undefined (reading 'forEach')when an mcq has no_items. Thev4.2.0testSuccessWhere(which includes itemless mcqs) already failed because of this.MCQ._items?.forEach(...)in the mutates and(MCQ._items ?? []).every(...)in the matching checks so an absent_itemsarray is handled gracefully (matching the pattern used by other components such as accordion).Testing
grunt migration:test --file=adapt-contrib-mcqtestSuccessWherefixtures.