Fix test suite compatibility with Node v24 (CJS/ESM, locutus v3, twing v6)#64
Open
alex-ahumada wants to merge 3 commits into
Open
Fix test suite compatibility with Node v24 (CJS/ESM, locutus v3, twing v6)#64alex-ahumada wants to merge 3 commits into
alex-ahumada wants to merge 3 commits into
Conversation
Author
|
My bad, the locutus imports issues were already addressed in #63, I missed that PR. |
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.
Node v24 exposed three pre-existing incompatibilities introduced by recent dependency and runtime upgrades. This PR fixes all three.
locutus 2.x → 3.x
exportsfield (./*→./esm/*.js). Importinglocutus/php/datetime/date.jswith the.jssuffix resolved to…/date.js.js, causing uncaught exceptions across the entire test suite. Fixed by using the bare pathlocutus/php/datetime/date.export function date). Updated toimport { date }.Node v24 CJS/ESM interop
module.exportskey to the namespace object when importing a CJS module as ESM. Theexports/tests were using a hardcodedObject.keys(exports).length - Nsubtraction that broke when this extra key appeared. Replaced with an explicit wrapper-key filter in all three exports tests.twing 5.x → 6.x
twing v5 calls
util.isNullOrUndefined, which Node v23 removed entirely, causing all 94 Twing tests to fail.twing v6 is a significant rewrite. Key breaking changes addressed.
new TwingFilter/FunctionremovedcreateFilter/createFunction(same arg order)executionContextas first arg_ctxfirst param to all 16 callablesenv.createTemplate(str)removedcreateArrayLoader({})+loader.setTemplate+env.loadTemplatesafe_joinjoin(ctx, val, glue, and)—and=undefinedleaks into outputnullexplicitly as 4th argplaceholderString(escaped)before falsy check inwrapPlaceholderwithout[]is a plain JS array, not a Map(_ctx, element, ...args)is_variadic: truetoactive_themeandactive_theme_pathrender_varacceptedArgumentsat compile timeacceptedArgumentsin function registrationcreate_attributetest.failing— now works correctly|keysrendering'Array'in string context (closer to PHP Twig)|join(",")in Twing-specificwithouttests