Skip to content

fix(rstest): rstest.importActual not work when imported from @rstest/core#12918

Merged
9aoy merged 1 commit intov1.xfrom
1.x-rstest-import-actual
Feb 3, 2026
Merged

fix(rstest): rstest.importActual not work when imported from @rstest/core#12918
9aoy merged 1 commit intov1.xfrom
1.x-rstest-import-actual

Conversation

@9aoy
Copy link
Copy Markdown
Contributor

@9aoy 9aoy commented Feb 3, 2026

Summary

fix(rstest): handle ESM imported rs/rstest variables in call_member_chain

Previously, rstest.importActual and rstest.requireActual only worked when rs or rstest were free (global) variables. When imported from @rstest/core via ESM (e.g., import { rstest } from '@rstest/core'), the for_name parameter in call_member_chain would be the ESM specifier tag instead of the variable name, causing the check to fail.

This fix extracts the variable name directly from the call_expr.callee AST node, enabling proper handling of ESM imported variables.

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

…st/core` (#12908)

* fix(rstest): handle ESM imported rs/rstest variables in call_member_chain

Previously, `rstest.importActual` and `rstest.requireActual` only worked
when `rs` or `rstest` were free (global) variables. When imported from
`@rstest/core` via ESM (e.g., `import { rstest } from '@rstest/core'`),
the `for_name` parameter in `call_member_chain` would be the ESM specifier
tag instead of the variable name, causing the check to fail.

This fix extracts the variable name directly from the `call_expr.callee`
AST node, enabling proper handling of ESM imported variables.

* feat: only handle global `rs` and `rstest` variables when globals true

* fix: clippy warnings

* fix: remove globals option (other PR)

* chore: useless Clippy lint ignore

* test: split cases
@9aoy 9aoy requested a review from LingyuCoder as a code owner February 3, 2026 03:06
@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: bug fix release: bug related release(mr only) labels Feb 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 3, 2026

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 5 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB -
react-1k 825.4 KB -
react-5k 2.7 MB -
rome 984.2 KB -
ui-components 2.1 MB -
📋 Detailed Reports (Click to expand)

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.7 MB - -
📄 JavaScript 5.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 825.4 KB - -
📄 JavaScript 825.4 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.7 MB - -
📄 JavaScript 2.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 984.2 KB - -
📄 JavaScript 984.2 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.1 MB - -
📄 JavaScript 2.0 MB - -
🎨 CSS 83.0 KB - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 3, 2026

📦 Binary Size-limit

Comparing 5aa57b4 to chore: bump swc_core from 55 to 56 and swc-experimental from 0.4.1 to 0.5.0 (#12906) by CPunisher

🎉 Size decreased by 316.63KB from 48.33MB to 48.02MB (⬇️0.64%)

@9aoy 9aoy requested a review from fi3ework February 3, 2026 03:20
@9aoy 9aoy changed the title fix(rstest): rstest.importActual not work when imported from `@rstest/core fix(rstest): rstest.importActual not work when imported from @rstest/core Feb 3, 2026
@9aoy 9aoy enabled auto-merge (squash) February 3, 2026 03:22
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 3, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing 1.x-rstest-import-actual (5aa57b4) with main (2f3aa4e)1

Summary

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark2

Footnotes

  1. No successful run was found on v1.x (634f7f9) during the generation of this report, so main (2f3aa4e) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@9aoy 9aoy merged commit f9caf8e into v1.x Feb 3, 2026
54 checks passed
@9aoy 9aoy deleted the 1.x-rstest-import-actual branch February 3, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants