{"record":{"id":"7b3d0dd038b2b65a","repo":"swc-project/swc","slug":"nnote-exclude-expects-one-or-more-comma-sepa","errorCode":null,"errorMessage":"{}\\nnote: exclude() expects one or more comma-separated regular expressions, like exclude(\".*\\\\.d\\\\.ts\") or exclude(\".*\\\\.d\\\\.ts\", \".*\\\\.tsx\")","messagePattern":"(.+?)\\\\nnote: exclude\\(\\) expects one or more comma-separated regular expressions, like exclude\\(\"\\.\\*\\\\\\\\\\.d\\\\\\\\\\.ts\"\\) or exclude\\(\"\\.\\*\\\\\\\\\\.d\\\\\\\\\\.ts\", \"\\.\\*\\\\\\\\\\.tsx\"\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/testing_macros/src/fixture.rs","lineNumber":41,"sourceCode":"}\n\nimpl Parse for Config {\n    fn parse(input: ParseStream) -> syn::Result<Self> {\n        fn update(c: &mut Config, meta: Meta) {\n            if let Meta::List(list) = &meta {\n                if list\n                    .path\n                    .get_ident()\n                    .map(|i| *i == \"exclude\")\n                    .unwrap_or(false)\n                {\n                    //\n                    macro_rules! fail {\n                        () => {{\n                            fail!(\"invalid input to the attribute\")\n                        }};\n                        ($inner:expr) => {{\n                            panic!(\n                                \"{}\\nnote: exclude() expects one or more comma-separated regular \\\n                                 expressions, like exclude(\\\".*\\\\\\\\.d\\\\\\\\.ts\\\") or \\\n                                 exclude(\\\".*\\\\\\\\.d\\\\\\\\.ts\\\", \\\".*\\\\\\\\.tsx\\\")\",\n                                $inner\n                            )\n                        }};\n                    }\n\n                    if list.tokens.is_empty() {\n                        fail!(\"empty exclude()\")\n                    }\n\n                    let input = parse2::<InputParen>(list.tokens.clone())\n                        .expect(\"failed to parse token as `InputParen`\");\n\n                    for lit in input.input {\n                        c.exclude_patterns\n                            .push(Regex::new(&lit.value()).unwrap_or_else(|err| {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/testing_macros/src/fixture.rs#L23-L59","documentation":"A macro-input validation error in the Parse impl for Config in swc_testing_macros (fixture.rs:41). When parsing the `exclude(...)` list of the #[fixture] attribute, any malformed token (wrong meta shape, non-string values, bad punctuation) triggers the inner fail! macro, which panics with 'invalid input to the attribute' and this note explaining that exclude expects one or more comma-separated regex strings like exclude(\".*\\\\.d\\\\.ts\"). The malformed attribute token stream is the input at fault.","triggerScenarios":"Thrown at crates/testing_macros/src/fixture.rs:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rewrite the exclude() argument as one or more comma-separated string literals containing regexes","Use raw strings or double-escape backslashes in regex literals (e.g. \".*\\\\.d\\\\.ts\")","Return a syn::Error with span instead of panicking so rustc points at the offending token"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}