Skip to content
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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

yoannmoinet
Copy link
Member

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?

  • Seed our builds during the tests, whenever we run runBundlers the build will happen in a seeded directory and will return a cleaning function.
  • Add custom jest matchers.
  • Aggregate and extract helpers getAbsolutePath, getResolvedPath, truncateString and doRequest.
  • Create a Bundle Report plugin and remove the GlobalContext initialisation from any internal plugin (it will simplify its usage for the injection plugin).

Comment on lines -78 to -86
// TODO: Add support and add outputFiles to the context.
rspack(compiler) {
globalContext.bundler.rawConfig = compiler.options;
},
farm: {
configResolved(config: any) {
globalContext.bundler.rawConfig = config;
},
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was dead code.

@yoannmoinet yoannmoinet marked this pull request as ready for review September 27, 2024 15:53
@yoannmoinet yoannmoinet requested a review from a team as a code owner September 27, 2024 15:53
@yoannmoinet yoannmoinet requested review from nchapma2 and removed request for a team September 27, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant