-
Notifications
You must be signed in to change notification settings - Fork 419
test(wtr): clean up hydration tests #5478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
instead of weird fake module
There's no setup/teardown needed, it's a single test, and WTR provides per-file encapsulation
working toward just importing and executing things, but not quite there yet
two env vars for the same goal is unnecessary
I think the last one was a concurrency related timeout, which was previously addressed.
config = config || {}; | ||
${moduleCode}; | ||
moduleOutput = LWC.renderComponent( | ||
`(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The returned value when running a script is the result of the last statement of the script. Using an IIFE1 allows us to avoid mucking around with the context object.
1 Technically we can just do LWC.renderComponent()
without wrapping it, but most people are probably unfamiliar with vm.Script
. I think that using a more familiar pattern makes it more clear what's going on.
}); | ||
const { | ||
default: { expectedSSRConsoleCalls, requiredFeatureFlags }, | ||
} = await import(path.join(ROOT_DIR, filePath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need all the extra bundling when import(configFile)
works just fine.
@@ -100,7 +99,7 @@ function throwOnUnexpectedConsoleCalls(runnable, expectedConsoleCalls = {}) { | |||
}; | |||
} | |||
try { | |||
runnable(); | |||
return runnable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔔 TIL: even if we return in try catch, finally still gets executed
Details
ENABLE_SYNTHETIC_IN_HYDRATION_MODE
does the same thing asDISABLE_SYNTHETIC
, just reversed.serve-hydration
plugin a bit. The goal is to get everything as close to pure ESM as possible, rather than confusing layers of wrapping and bundling and indirection.Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item