From 7091925a3ac1b6159bef0c33c75cb2f481d24c73 Mon Sep 17 00:00:00 2001 From: ayushcodes10 Date: Mon, 14 Sep 2026 14:47:30 +0530 Subject: [PATCH] Add a test for rest pattern skip in destructured exports A rest element does not correspond to one discrete exported name, so it must be skipped rather than mangled into a bogus node, and its sibling names must still extract cleanly. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh --- tests/test_js_destructured_export.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_js_destructured_export.py b/tests/test_js_destructured_export.py index 814bcdca8..d7b5a0982 100644 --- a/tests/test_js_destructured_export.py +++ b/tests/test_js_destructured_export.py @@ -71,3 +71,16 @@ def test_renamed_property_exports_under_its_key_not_its_local_alias(tmp_path): labels = set(lbl.values()) assert "handlers" in labels assert "h" not in labels + + +def test_rest_pattern_is_skipped_not_mangled(tmp_path): + # `...rest` does not correspond to one discrete exported name; it must + # not produce a node, and must not break extraction of its siblings. + r, lbl = _extract(tmp_path, { + "auth.ts": _NEXTAUTH_HELPER + + "export const { auth, ...rest } = NextAuth({});\n", + }) + labels = set(lbl.values()) + assert "auth" in labels + assert "rest" not in labels + assert not any("rest" in label for label in labels)