Skip to content

Comments

test(dev): support full reload in tests#6259

Merged
graphite-app[bot] merged 1 commit intomainfrom
09-17-test_dev_support_full_reload_in_tests
Sep 17, 2025
Merged

test(dev): support full reload in tests#6259
graphite-app[bot] merged 1 commit intomainfrom
09-17-test_dev_support_full_reload_in_tests

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Sep 17, 2025

Added support for full reloads in the node hmr test infra.

Copy link
Member Author

sapphi-red commented Sep 17, 2025


How to use the Graphite Merge Queue

Add the label graphite: merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@netlify
Copy link

netlify bot commented Sep 17, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 51820d3
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/68cae343a6914a00080c305d

@sapphi-red sapphi-red marked this pull request as ready for review September 17, 2025 11:56
@sapphi-red sapphi-red requested a review from hyf0 September 17, 2025 11:56
@sapphi-red sapphi-red changed the base branch from main to graphite-base/6259 September 17, 2025 12:28
@sapphi-red sapphi-red force-pushed the 09-17-test_dev_support_full_reload_in_tests branch from b66b250 to f03bf87 Compare September 17, 2025 12:29
@sapphi-red sapphi-red changed the base branch from graphite-base/6259 to 09-17-test_dev_extract_waitfor_from_waitforpathexists September 17, 2025 12:29
Copy link
Member

hyf0 commented Sep 17, 2025

Merge activity

  • Sep 17, 1:44 PM UTC: The merge label 'graphite: merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 17, 1:44 PM UTC: hyf0 added this pull request to the Graphite merge queue.
  • Sep 17, 1:56 PM UTC: The Graphite merge queue couldn't merge this PR because it had merge conflicts.
  • Sep 17, 4:34 PM UTC: The merge label 'graphite: merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 17, 4:34 PM UTC: hyf0 added this pull request to the Graphite merge queue.
  • Sep 17, 4:45 PM UTC: Merged by the Graphite merge queue.

@graphite-app graphite-app bot changed the base branch from 09-17-test_dev_extract_waitfor_from_waitforpathexists to graphite-base/6259 September 17, 2025 13:44
graphite-app bot pushed a commit that referenced this pull request Sep 17, 2025
Extracted `waitFor` from `waitForPathExists` to use it for `waitForFileToBeModified` in #6259.
@graphite-app graphite-app bot changed the base branch from graphite-base/6259 to main September 17, 2025 13:55
@hyf0 hyf0 force-pushed the 09-17-test_dev_support_full_reload_in_tests branch from f03bf87 to 292f5cd Compare September 17, 2025 16:07
Added support for full reloads in the node hmr test infra.
@graphite-app graphite-app bot force-pushed the 09-17-test_dev_support_full_reload_in_tests branch from 292f5cd to 51820d3 Compare September 17, 2025 16:35
@graphite-app graphite-app bot merged commit 51820d3 into main Sep 17, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 09-17-test_dev_support_full_reload_in_tests branch September 17, 2025 16:45
if (this.#devOptions?.platform === 'browser') {
// TODO: send reload message to client
}
this.#devEngine?.ensureLatestBuild();
Copy link
Member

Choose a reason for hiding this comment

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

I guess this might be not stable even with adding await.

We need to ensure, before calling node main.js, await this.#devEngine?.ensureLatestBuild(). Just like how did for browser platform.

Copy link
Member

Choose a reason for hiding this comment

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

My epxectation of the process would be:
(Dev server sending reload message to client) -> (Client recived reload message, finds itself can't handle it, and then send a message to dev server to require reload) -> (Dev server ensures latest build output and reload).

This requires dev server to manage the lifecycle of node process, which is kind of expected I guess? (I wonder if this is how vite-node works.

Dev server needs a http-server to support develpoment for browser. It also makes sense we need a equal concept/tool for node.


I also tried to explore solution that's similar to browser's, which is to implement an reload() in nodejs.

ChatGPT tells that it might be feasible with injecting runtime code that start a new process that responsible to close the previous node process and start a new one.

However, it's just an idea.


Another solution would be the dev-server could brocast a event to notify fixture.test.ts that the build output is fresh.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason of adding this.#devEngine?.ensureLatestBuild(); here is to trigger the rebuild. It doesn't require waiting the build to finish.
The waiting is done at https://github.com/rolldown/rolldown/pull/6259/files#diff-3ea7fe1271d5080b97d22732d516b71771bac38d798d13ad0a4dc1a7d15d325cR156-R159 instead. (it is waiting the file to be output before calling node main.js)

Copy link
Member Author

@sapphi-red sapphi-red Sep 18, 2025

Choose a reason for hiding this comment

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

This requires dev server to manage the lifecycle of node process

Yes, that would be the way if we were to implement it for actual usecases. But that's quite complicated. I implemented a more easy way that would work fine for tests (which is to manage the node process in the test script).

Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if this is how vite-node works.

vite-node simply re-executes the files (and doesn't require restarting the process), because it has the module-runner which is isolated from the actual node's module loader system.

Copy link
Member Author

Choose a reason for hiding this comment

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

also tried to explore solution that's similar to browser's, which is to implement an reload() in nodejs.

It might work. But maybe tricky as the new process spawned would be a child process of the old process. That might cause the new process to close when the old process closes?

shulaoda pushed a commit that referenced this pull request Sep 22, 2025
## [1.0.0-beta.39] - 2025-09-22

⚡ MacOS Performance Boost

- 10%-30% faster bundling
- Up to 45% in extreme cases

### 🚀 Features

- rolldown: oxc v0.90.0 + other oxc crate updates (#6274) by @Boshen
- support ignoring `/* @vite-ignore */` comment for dynamic imports (#6264) by @IWANABETHATGUY
- dev: merge mergeable queued tasks into one (#6253) by @hyf0
- dev: ignore self imports when computing update for invalidate (#6252) by @sapphi-red
- support `#__NO_SIDE_EFFECTS__` annotation for export default function declaration (#6239) by @IWANABETHATGUY
- rolldown_plugin_dynamic_import_vars: respect `@vite-ignore` comment (#6240) by @shulaoda
- rolldown_plugin_import_glob: support `exhaustive` option (#6236) by @shulaoda
- cross chunk /* @__NO_SIDE_EFFECTS__ */ support (#6207) by @IWANABETHATGUY
- rolldown_plugin_react_refresh_wrapper: make the plugin callable (#6229) by @sapphi-red

### 🐛 Bug Fixes

- handle optional chaining in scope hoisting member expression rewriting (#6278) by @shulaoda
- release: Fix semver commit release format to use plus instead of dash (#6273) by @Copilot
- dev: `ensure_latest_build_output` should work correctly when `eagerBuild: false` (#6262) by @hyf0
- browser: does not work in stackblitz (#6257) by @shulaoda
- only inline constants that are not reassigned (#6247) by @IWANABETHATGUY
- handle lexical declarations in root scope (#6230) by @IWANABETHATGUY

### 🚜 Refactor

- move oxc runtime helper generation from `build.rs` to task generator (#6284) by @shulaoda
- remove unused `SpanExt` (#6266) by @IWANABETHATGUY
- remove `@rolldown-ignore` ignore comment support (#6265) by @IWANABETHATGUY
- enhance CommonJsAstType to track property names (#6250) by @IWANABETHATGUY
- simplify usage for `Address::from` (#6245) by @IWANABETHATGUY
- remove `stmt_info_idx` in StmtInfo (#6244) by @IWANABETHATGUY
- extract `CrossModuleOptimizationRunnerContext` in cross_module_optimization (#6243) by @IWANABETHATGUY
- dev: task-queue based deisgn (#6233) by @hyf0
- extract immutable context from AstScanner (#6238) by @IWANABETHATGUY
- dev: rename `WatcherEventService` to `BuildDriverService` (#6232) by @hyf0
- move FlatOptions to rolldown_common (#6235) by @IWANABETHATGUY
- extract mutable state from ScopeHoistingFinalizerContext (#6234) by @IWANABETHATGUY
- wait `this.load` using futures instead of callbacks (#6222) by @sapphi-red
- rolldown_plugin_transform: remove unused `runtime_resolve_base` option (#6226) by @sapphi-red

### 📚 Documentation

- add "edit this page on GitHub" button (#6241) by @siaeyy

### ⚡ Performance

- rolldown: minor performance optimization (#6271) by @Brooooooklyn
- rolldown: take advantage of tokio blocking threads (#6270) by @Brooooooklyn

### 🧪 Testing

- dev: add rebuild after HMR case (#6260) by @sapphi-red
- dev: support full reload in tests (#6259) by @sapphi-red
- dev: extract waitFor from waitForPathExists (#6261) by @sapphi-red
- add class like cases for empty function optimizations (#6248) by @sapphi-red

### ⚙️ Miscellaneous Tasks

- deps: update github-actions (#6298) by @renovate[bot]
- deps: update dependency dprint/dprint-plugin-typescript to v0.95.11 (#6296) by @renovate[bot]
- deps: update dependency dprint/dprint-plugin-markdown to v0.19.0 (#6295) by @renovate[bot]
- deps: update dependency g-plane/pretty_yaml to v0.5.1 (#6294) by @renovate[bot]
- use a forked version of openharmony-rs/setup-ohos-sdk (#6290) by @Boshen
- deps: update dependency tsdown to v0.15.4 (#6286) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.16.7 (#6285) by @renovate[bot]
- rust: continue to make `cargo publish --workspace` work (#6281) by @Boshen
- deps: update dependency tsdown to v0.15.3 (#6280) by @renovate[bot]
- rust: fixes for `cargo publish --dry-run --workspace` (#6279) by @Boshen
- deps: update dependency rust to v1.90.0 (#6277) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.16.6 (#6276) by @renovate[bot]
- adding tracing for all sub stage in LinkStage:link (#6268) by @IWANABETHATGUY
- deps: update oxc-project/setup-node action to v1.0.4 (#6258) by @renovate[bot]
- deps: update github-actions (#6249) by @renovate[bot]
- deps: update dependency tsdown to v0.15.2 (#6242) by @renovate[bot]
- dev: output error when the initial bundle failed (#6228) by @sapphi-red

### ❤️ New Contributors

* @siaeyy made their first contribution in [#6241](#6241)
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.

2 participants