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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add rust rebuild test function feature #3091

Merged
merged 5 commits into from
May 11, 2023

Conversation

suxin2017
Copy link
Collaborator

@suxin2017 suxin2017 commented May 10, 2023

Related issue (if exists)

Summary

馃 Generated by Copilot at 50a05bb

This pull request adds a new function test_hmr_fixture to the rspack_testing crate, which tests the hot module reloading (HMR) feature of the rspack tool. It also updates and adds some examples to demonstrate and compare the HMR feature with the normal build feature. The examples use hard-coded fixture paths and console log statements.

Walkthrough

馃 Generated by Copilot at 50a05bb

  • Add a new function test_hmr_fixture to the rspack_testing crate that tests the hot module replacement (HMR) feature of the compiler for a given fixture (link, link, link)
  • Add two examples of how to use the test_hmr_fixture function in the test-cli.rs and test-hmr-cli.rs files (link, link, link)
  • Add a new test.config.json file to the simple example to provide some configuration options for the testing framework or the compiler (link)
  • Add some console log statements to the index.js file in the simple example to demonstrate or debug the HMR feature or the module caching behavior (link, link)
  • Add the expected output of the compiler for the simple example in the main.js file (link)

@suxin2017
Copy link
Collaborator Author

Do we need hot update tests for rust, because I don't know how to do hot update tests in rust because of the lack of this tool

@ahabhgk @h-a-n-a

@ahabhgk
Copy link
Collaborator

ahabhgk commented May 10, 2023

I don't suggest add hmr test at rust side, hmr can't works without @rspack/dev-server, which is written in js, so normally we test hmr at js side.

@suxin2017
Copy link
Collaborator Author

I don't suggest add hmr test at rust side, hmr can't works without @rspack/dev-server, which is written in js, so normally we test hmr at js side.

Maybe there is something wrong with the description of my proposal. I want to add the test method of rebuild to the rust layer, through the changed and removed files, to facilitate testing possible problems in the rebuild process

@ahabhgk
Copy link
Collaborator

ahabhgk commented May 10, 2023

IMO test at rust side enable better debug experience, so rebuild test at rust side is nice to have, you can checkout packages/rspack/tests/WatchTestCases.test.ts for reference, it's written in js but the main idea is using writeFile to trigger the rebuild, I think we can do the same in rust side.

@suxin2017
Copy link
Collaborator Author

IMO test at rust side enable better debug experience, so rebuild test at rust side is nice to have, you can checkout packages/rspack/tests/WatchTestCases.test.ts for reference, it's written in js but the main idea is using writeFile to trigger the rebuild, I think we can do the same in rust side.

So it makes sense, right? So I'm going to follow up

@suxin2017 suxin2017 changed the title chore: add rust hot update test feature chore: add rust rebuild test function feature May 10, 2023
@suxin2017 suxin2017 marked this pull request as ready for review May 10, 2023 08:07
@suxin2017 suxin2017 requested a review from ahabhgk as a code owner May 10, 2023 08:07
@hyf0
Copy link
Collaborator

hyf0 commented May 11, 2023

Thank you!

@hyf0 hyf0 added this pull request to the merge queue May 11, 2023
Merged via the queue into web-infra-dev:main with commit b306356 May 11, 2023
11 checks passed
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.

None yet

4 participants