-
Notifications
You must be signed in to change notification settings - Fork 5
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
[DX] Improve tests experience #99
Conversation
// TODO: Add support and add outputFiles to the context. | ||
rspack(compiler) { | ||
globalContext.bundler.rawConfig = compiler.options; | ||
}, | ||
farm: { | ||
configResolved(config: any) { | ||
globalContext.bundler.rawConfig = config; | ||
}, | ||
}, |
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.
This was dead code.
4eaed23
to
74f010b
Compare
try { | ||
return require.resolve(filepath); | ||
} catch (e) { | ||
export const getAbsolutePath = (filepath: string, cwd: string) => { |
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.
TBH the order of the arguments confused me a bit since they are reversed when applied to path.resolve
(and the leftmost cwd
path ends up being the last function argument):
filepath: string, cwd: string
-> path.resolve(cwd, 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.
Agreed, it got me a few times too.
I'll change it, just needed a little nudge to convince me.
What and why?
In preparation for the internal injection plugin we need to re-enforce how we use the bundlers in our tests.
We also need to untie the GlobalContext from any plugin.
Finally, extract some helpers that will be needed for the injection plugin.
How?
runBundlers
the build will happen in a seeded directory and will return a cleaning function.getAbsolutePath
,getResolvedPath
,truncateString
anddoRequest
.