{"record":{"id":"332601e957f86fd2","repo":"swc-project/swc","slug":"expected-something-like-got-wrong-meta-tag","errorCode":null,"errorMessage":"Expected something like {}\nGot wrong meta tag: {:?}","messagePattern":"Expected something like (.+?)\nGot wrong meta tag: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/testing_macros/src/fixture.rs","lineNumber":70,"sourceCode":"                    }\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| {\n                                fail!(format!(\"failed to parse regex: {}\\n{}\", lit.value(), err))\n                            }));\n                    }\n\n                    return;\n                }\n            }\n\n            let expected = r#\"#[fixture(\"fixture/**/*.ts\", exclude(\"*\\.d\\.ts\"))]\"#;\n\n            unimplemented!(\n                \"Expected something like {}\\nGot wrong meta tag: {:?}\",\n                expected,\n                meta,\n            )\n        }\n\n        let pattern: LitStr = input.parse()?;\n        let pattern = pattern.value();\n\n        let mut config = Self {\n            pattern,\n            exclude_patterns: Vec::new(),\n        };\n\n        let comma: Option<Token![,]> = input.parse()?;\n        if comma.is_some() {\n            let meta: Meta = input.parse()?;\n            update(&mut config, meta);","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/testing_macros/src/fixture.rs#L52-L88","documentation":"The #[fixture(...)] attribute from swc's testing_macros expands into one #[test] per file matched by a glob, and its Config::parse accepts exactly: a string-literal glob pattern, optionally followed by comma-separated exclude(\"regex\") entries. The first token is parsed as LitStr (so it must be a quoted string); any subsequent meta element that is not an exclude(...) list falls through to unimplemented!(\"Expected something like ...\\nGot wrong meta tag: ...\") — a compile-time panic that prints the expected form.","triggerScenarios":"Writing #[fixture(tests/fixture/**/*.ts)] with an unquoted glob, or any second argument that is not exclude(\"...\") — e.g. #[fixture(\"...\", include(\"...\"))], #[fixture(\"...\", exclude = \"...\")], or a name=value meta. Only `#[fixture(\"glob\", exclude(\"re\", ...))]` parses.","commonSituations":"Adding fixture suites to swc-family crates; copy-pasting from tests that use different macro conventions; assuming exclude accepts identifiers or unquoted regexes; escaping mistakes in the regex making authors try alternate syntaxes.","solutions":["Quote the glob pattern as a string literal: #[fixture(\"tests/fixture/**/*.ts\")].","Express exclusions only as exclude(\"regex\") with string-literal regexes: #[fixture(\"...\", exclude(\".*\\\\.d\\\\.ts\"))].","List multiple exclusions inside one exclude() as comma-separated strings rather than repeating the meta.","Compare against the canonical example printed in the panic message: #[fixture(\"fixture/**/*.ts\", exclude(\"*\\\\.d\\\\.ts\"))]."],"exampleFix":"// before: compile-time panic 'Expected something like #[fixture(...)]'\n#[fixture(tests/fixture/**/*.ts)]\n#[fixture(\"tests/**\", exclude = \".*\\\\.snap\")]\n\n// after\n#[fixture(\"tests/fixture/**/*.ts\", exclude(\".*\\\\.d\\\\.ts\", \".*\\\\.snap\"))]","handlingStrategy":"validation","validationCode":"# CI: flag #[fixture(...)] attributes whose first argument is not a quoted string literal\nrg -nP '#\\[fixture\\(\\s*[^\" )]' crates --glob '*.rs' \\\n  && { echo 'malformed #[fixture] first argument (must be a quoted glob)'; exit 1; } || true","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy the canonical form from the panic message: #[fixture(\"fixture/**/*.ts\", exclude(\"*\\\\.d\\\\.ts\"))]","Always quote the glob and every exclude regex","Keep fixture suites next to existing ones and mirror their attribute style"],"tags":["proc-macro","attribute-macro","fixture-tests","testing-macros","compile-time"],"backgroundTag":"attribute-macro-argument-syntax","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"}