Remove legacy test utils#957
Merged
Perryvw merged 10 commits intoTypeScriptToLua:masterfrom Feb 6, 2021
Merged
Conversation
Fixed function assignment test according to discord discussion (https://discord.com/channels/515854149821267971/600291243523702805/800403280512417792) Fixed hoisting by hardcoding the expected value, because the current TestBuilder.executeJS() setup does not handle module hoisting
Perryvw
reviewed
Jan 28, 2021
tomblind
reviewed
Jan 30, 2021
Collaborator
tomblind
left a comment
There was a problem hiding this comment.
Looks good. I'm not seeing anything that should mess with test results.
test/unit/functions/validation/functionExpressionTypeInference.spec.ts
Outdated
Show resolved
Hide resolved
Perryvw
reviewed
Jan 30, 2021
test/unit/functions/validation/functionExpressionTypeInference.spec.ts
Outdated
Show resolved
Hide resolved
Perryvw
reviewed
Feb 4, 2021
Perryvw
approved these changes
Feb 5, 2021
tomblind
approved these changes
Feb 6, 2021
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.
Removed legacy test utils and replaced all remaining usages with
TestBuilder. I tried to useexpectJSResult()whenever possible.Also improved support for multi file tests
TestBuilder.addExtraFilenow works for all the different factories (testBundle, testModule, testFunction, testExpression ...):In Lua this is achieved by loading extra files into
packages.loadedvia the Lua API.This mechanism is now also used to inject our test dependencies (lualib & JSON.Stringify).
In JS a custom require in conjunction with node's
vmmodule is used. The JS setup is a bit hacky at the moment (global support is basic and import hoisting does not work). This can be approved significantly once https://nodejs.org/api/vm.html#vm_class_vm_module becomes stable.Needs very thorough review, because this could potentially break tests.