fix(rstest): rstest.importActual not work when imported from @rstest/core#12918
fix(rstest): rstest.importActual not work when imported from @rstest/core#12918
rstest.importActual not work when imported from @rstest/core#12918Conversation
…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
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 5 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 react-10kPath:
📁 react-1kPath:
📁 react-5kPath:
📁 romePath:
📁 ui-componentsPath:
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🎉 Size decreased by 316.63KB from 48.33MB to 48.02MB (⬇️0.64%) |
rstest.importActual not work when imported from `@rstest/corerstest.importActual not work when imported from @rstest/core
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
Summary
fix(rstest): handle ESM imported rs/rstest variables in call_member_chain
Previously,
rstest.importActualandrstest.requireActualonly worked whenrsorrstestwere free (global) variables. When imported from@rstest/corevia ESM (e.g.,import { rstest } from '@rstest/core'), thefor_nameparameter incall_member_chainwould 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.calleeAST node, enabling proper handling of ESM imported variables.Related links
Checklist