[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69B69SPZQSR8YNAZMMNERE4":3,"skill-same:01M69B69SPZQSR8YNAZMMNERE4":89},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":37,"publishedAt":60,"linkOnly":61,"markdownContent":62,"markdownBody":63,"frontMatter":64,"refName":65,"commitSha":66,"skillDirectory":67,"forksCount":68,"repositoryHtmlUrl":69,"repositoryHomepageUrl":70,"ownerHtmlUrl":71,"ownerBlogUrl":72,"ownerDescription":73,"updatedAt":74,"install":75,"resources":88},"01M69B69SPZQSR8YNAZMMNERE4","backend-tests",null,"Use when writing unit tests under test\u002Funit-tests\u002Fbackend\u002F*.test.ts that run in Node with Mocha+Chai and no VS Code API. For pure logic: parsers, helpers, env merging. Triggers: \"backend test\", \"unit test\", \"mocha test without vscode\".","microsoft\u002Fvscode-cmake-tools","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M69B5ZETEJ3WM91BA2ZYMTYT",1688,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvscode-cmake-tools\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fbackend-tests\u002FSKILL.md",[18,23,26,29,34],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":30,"categoryName":31,"taxonomyType":32,"taxonomyTypeDesc":33},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",{"categoryNo":35,"categoryName":36,"taxonomyType":32,"taxonomyTypeDesc":33},"01JBSEEDCAT000000000000036","内容创作者",[38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],"backend tests","backend","tests","helpers","writing","when","unit test","for","mocha","unit-tests","unit","chai","triggers","use","node","parsers","api","code","run","unit tests","vscode","test","2026-11-10 10:12:30",false,"---\nname: backend-tests\ndescription: >\n  Use when writing unit tests under test\u002Funit-tests\u002Fbackend\u002F*.test.ts that run in\n  Node with Mocha+Chai and no VS Code API. For pure logic: parsers, helpers, env\n  merging. Triggers: \"backend test\", \"unit test\", \"mocha test without vscode\".\n---\n\n# Writing Backend Tests\n\nRecipe for adding backend (unit) tests that run without VS Code.\n\n## When to use backend tests\n\nUse backend tests for **pure logic** that has no VS Code UI interaction. They are the\nfastest feedback loop — no Extension Host, no display server, just Node + Mocha.\n\nGood candidates: string manipulation, path logic, parsers, encoding, variable expansion,\ndata-structure helpers, environment merging.\n\n**Not** suitable for: anything that calls `vscode.window.*`, `vscode.workspace.*` beyond\n`getConfiguration()`, or depends on an active editor.\n\n---\n\n## File location\n\n```\ntest\u002Funit-tests\u002Fbackend\u002F\u003Cname>.test.ts\n```\n\n---\n\n## Import strategy — decision tree\n\n### Module has NO transitive `vscode` dependency\n\nImport directly via the `@cmt\u002F*` path alias.\n\n```typescript\n\u002F\u002F encoding.test.ts — encodingUtils has no vscode imports\nimport { isValidUtf8 } from '@cmt\u002FencodingUtils';\n```\n\n### Module transitively imports `vscode`\n\n**Mirror** the pure function logic inline in the test file. Do **not** import the\nsource module — it will fail because `vscode` cannot be resolved at test time\n(even with the mock, deep transitive chains can break).\n\n```typescript\n\u002F\u002F expand.test.ts — expand.ts transitively depends on vscode\n\u002F\u002F Mirror of expand.substituteAll\nfunction substituteAll(input: string, subs: Map\u003Cstring, string>) {\n    let finalString = input;\n    let didReplacement = false;\n    subs.forEach((value, key) => {\n        if (value !== key) {\n            const pattern = key.replace(\u002F[.*+?^${}()|[\\]\\\\]\u002Fg, '\\\\$&');\n            const re = new RegExp(pattern, 'g');\n            finalString = finalString.replace(re, value);\n            didReplacement = true;\n        }\n    });\n    return { result: finalString, didReplacement };\n}\n```\n\nAdd a comment like `\u002F\u002F --- Mirror of \u003Cmodule>.\u003Cfunction> ---` so reviewers\ncan trace back to the source.\n\n### What `setup-vscode-mock.ts` provides\n\nThe mock is auto-loaded via Mocha's `-r` flag. It intercepts `require('vscode')` and\nreturns stubs for:\n\n- `workspace.getConfiguration()` — returns a Proxy that yields `undefined`\n- `workspace.onDidChangeConfiguration` \u002F `onDidCreateFiles` \u002F `onDidDeleteFiles` — no-ops\n- `window.createOutputChannel` \u002F `showErrorMessage` \u002F `showWarningMessage` — no-ops\n- `commands.registerCommand` \u002F `executeCommand` — no-ops\n- `Position`, `Range`, `Uri` — minimal implementations\n- `EventEmitter`, `Disposable`, `TreeItem`, `ThemeIcon` — stubs\n\nThis lets some modules with shallow `vscode` dependencies work. If your module only\ntouches `vscode.workspace.getConfiguration()`, direct import may still work. Test it —\nif it fails, fall back to the mirror pattern.\n\n---\n\n## Test framework\n\n| Aspect | Value |\n|--------|-------|\n| **Runner** | Mocha |\n| **Style** | TDD — use `suite()` \u002F `test()`, **not** `describe()` \u002F `it()` |\n| **Assertions** | Chai `expect` — `import { expect } from 'chai'` |\n| **Path aliases** | `@cmt\u002F*` → `src\u002F*`, `@test\u002F*` → `test\u002F*` |\n\n---\n\n## Skeleton — direct import pattern\n\n```typescript\nimport { expect } from 'chai';\nimport { myFunction } from '@cmt\u002FmyModule';\n\nsuite('[myFunction]', () => {\n    test('does the expected thing', () => {\n        const result = myFunction('input');\n        expect(result).to.equal('expected');\n    });\n\n    test('handles edge case', () => {\n        expect(myFunction('')).to.equal('');\n    });\n});\n```\n\n## Skeleton — mirror pattern\n\n```typescript\nimport { expect } from 'chai';\n\n\u002F**\n * Tests for pure utility functions in src\u002FsomeModule.ts.\n * Functions are mirrored here because someModule.ts transitively\n * depends on 'vscode'.\n *\u002F\n\n\u002F\u002F --- Mirror of someModule.helperFn ---\nfunction helperFn(input: string): string {\n    \u002F\u002F Copy the implementation verbatim from the source\n    return input.trim().toLowerCase();\n}\n\nsuite('[helperFn]', () => {\n    test('trims and lowercases', () => {\n        expect(helperFn('  Hello  ')).to.equal('hello');\n    });\n\n    test('empty string', () => {\n        expect(helperFn('')).to.equal('');\n    });\n});\n```\n\n---\n\n## Run command\n\n```bash\nyarn backendTests\n```\n\nFull command (for reference):\n\n```bash\nnode .\u002Fnode_modules\u002Fmocha\u002Fbin\u002F_mocha \\\n  -u tdd \\\n  --timeout 999999 \\\n  --colors \\\n  -r ts-node\u002Fregister \\\n  -r tsconfig-paths\u002Fregister \\\n  -r test\u002Funit-tests\u002Fbackend\u002Fsetup-vscode-mock.ts \\\n  .\u002Ftest\u002Funit-tests\u002Fbackend\u002F**\u002F*.test.ts\n```\n\n---\n\n## Common pitfalls\n\n| Pitfall | Fix |\n|---------|-----|\n| `Cannot find module 'vscode'` | Module has a transitive vscode dependency — use the mirror pattern |\n| `suite is not defined` | Mocha TDD interface not loaded — ensure you run via `yarn backendTests`, not `mocha` directly |\n| Import path uses relative `..\u002F..\u002F..\u002Fsrc\u002F` | Use `@cmt\u002F*` alias instead — `tsconfig-paths\u002Fregister` resolves it |\n| `describe`\u002F`it` used instead of `suite`\u002F`test` | This project uses Mocha TDD style — switch to `suite`\u002F`test` |\n| Mock returns `undefined` for a config value | `setup-vscode-mock.ts`'s `getConfiguration()` returns `undefined` for everything — if your code needs a real value, you may need to extend the mock or restructure |\n\n---\n\n*See also: [`.github\u002Fcopilot-instructions.md`](..\u002Fcopilot-instructions.md) for project-wide conventions.*\n","# Writing Backend Tests\n\nRecipe for adding backend (unit) tests that run without VS Code.\n\n## When to use backend tests\n\nUse backend tests for **pure logic** that has no VS Code UI interaction. They are the\nfastest feedback loop — no Extension Host, no display server, just Node + Mocha.\n\nGood candidates: string manipulation, path logic, parsers, encoding, variable expansion,\ndata-structure helpers, environment merging.\n\n**Not** suitable for: anything that calls `vscode.window.*`, `vscode.workspace.*` beyond\n`getConfiguration()`, or depends on an active editor.\n\n---\n\n## File location\n\n```\ntest\u002Funit-tests\u002Fbackend\u002F\u003Cname>.test.ts\n```\n\n---\n\n## Import strategy — decision tree\n\n### Module has NO transitive `vscode` dependency\n\nImport directly via the `@cmt\u002F*` path alias.\n\n```typescript\n\u002F\u002F encoding.test.ts — encodingUtils has no vscode imports\nimport { isValidUtf8 } from '@cmt\u002FencodingUtils';\n```\n\n### Module transitively imports `vscode`\n\n**Mirror** the pure function logic inline in the test file. Do **not** import the\nsource module — it will fail because `vscode` cannot be resolved at test time\n(even with the mock, deep transitive chains can break).\n\n```typescript\n\u002F\u002F expand.test.ts — expand.ts transitively depends on vscode\n\u002F\u002F Mirror of expand.substituteAll\nfunction substituteAll(input: string, subs: Map\u003Cstring, string>) {\n    let finalString = input;\n    let didReplacement = false;\n    subs.forEach((value, key) => {\n        if (value !== key) {\n            const pattern = key.replace(\u002F[.*+?^${}()|[\\]\\\\]\u002Fg, '\\\\$&');\n            const re = new RegExp(pattern, 'g');\n            finalString = finalString.replace(re, value);\n            didReplacement = true;\n        }\n    });\n    return { result: finalString, didReplacement };\n}\n```\n\nAdd a comment like `\u002F\u002F --- Mirror of \u003Cmodule>.\u003Cfunction> ---` so reviewers\ncan trace back to the source.\n\n### What `setup-vscode-mock.ts` provides\n\nThe mock is auto-loaded via Mocha's `-r` flag. It intercepts `require('vscode')` and\nreturns stubs for:\n\n- `workspace.getConfiguration()` — returns a Proxy that yields `undefined`\n- `workspace.onDidChangeConfiguration` \u002F `onDidCreateFiles` \u002F `onDidDeleteFiles` — no-ops\n- `window.createOutputChannel` \u002F `showErrorMessage` \u002F `showWarningMessage` — no-ops\n- `commands.registerCommand` \u002F `executeCommand` — no-ops\n- `Position`, `Range`, `Uri` — minimal implementations\n- `EventEmitter`, `Disposable`, `TreeItem`, `ThemeIcon` — stubs\n\nThis lets some modules with shallow `vscode` dependencies work. If your module only\ntouches `vscode.workspace.getConfiguration()`, direct import may still work. Test it —\nif it fails, fall back to the mirror pattern.\n\n---\n\n## Test framework\n\n| Aspect | Value |\n|--------|-------|\n| **Runner** | Mocha |\n| **Style** | TDD — use `suite()` \u002F `test()`, **not** `describe()` \u002F `it()` |\n| **Assertions** | Chai `expect` — `import { expect } from 'chai'` |\n| **Path aliases** | `@cmt\u002F*` → `src\u002F*`, `@test\u002F*` → `test\u002F*` |\n\n---\n\n## Skeleton — direct import pattern\n\n```typescript\nimport { expect } from 'chai';\nimport { myFunction } from '@cmt\u002FmyModule';\n\nsuite('[myFunction]', () => {\n    test('does the expected thing', () => {\n        const result = myFunction('input');\n        expect(result).to.equal('expected');\n    });\n\n    test('handles edge case', () => {\n        expect(myFunction('')).to.equal('');\n    });\n});\n```\n\n## Skeleton — mirror pattern\n\n```typescript\nimport { expect } from 'chai';\n\n\u002F**\n * Tests for pure utility functions in src\u002FsomeModule.ts.\n * Functions are mirrored here because someModule.ts transitively\n * depends on 'vscode'.\n *\u002F\n\n\u002F\u002F --- Mirror of someModule.helperFn ---\nfunction helperFn(input: string): string {\n    \u002F\u002F Copy the implementation verbatim from the source\n    return input.trim().toLowerCase();\n}\n\nsuite('[helperFn]', () => {\n    test('trims and lowercases', () => {\n        expect(helperFn('  Hello  ')).to.equal('hello');\n    });\n\n    test('empty string', () => {\n        expect(helperFn('')).to.equal('');\n    });\n});\n```\n\n---\n\n## Run command\n\n```bash\nyarn backendTests\n```\n\nFull command (for reference):\n\n```bash\nnode .\u002Fnode_modules\u002Fmocha\u002Fbin\u002F_mocha \\\n  -u tdd \\\n  --timeout 999999 \\\n  --colors \\\n  -r ts-node\u002Fregister \\\n  -r tsconfig-paths\u002Fregister \\\n  -r test\u002Funit-tests\u002Fbackend\u002Fsetup-vscode-mock.ts \\\n  .\u002Ftest\u002Funit-tests\u002Fbackend\u002F**\u002F*.test.ts\n```\n\n---\n\n## Common pitfalls\n\n| Pitfall | Fix |\n|---------|-----|\n| `Cannot find module 'vscode'` | Module has a transitive vscode dependency — use the mirror pattern |\n| `suite is not defined` | Mocha TDD interface not loaded — ensure you run via `yarn backendTests`, not `mocha` directly |\n| Import path uses relative `..\u002F..\u002F..\u002Fsrc\u002F` | Use `@cmt\u002F*` alias instead — `tsconfig-paths\u002Fregister` resolves it |\n| `describe`\u002F`it` used instead of `suite`\u002F`test` | This project uses Mocha TDD style — switch to `suite`\u002F`test` |\n| Mock returns `undefined` for a config value | `setup-vscode-mock.ts`'s `getConfiguration()` returns `undefined` for everything — if your code needs a real value, you may need to extend the mock or restructure |\n\n---\n\n*See also: [`.github\u002Fcopilot-instructions.md`](..\u002Fcopilot-instructions.md) for project-wide conventions.*\n",{"name":5,"description":7},"main","e0969b894e56d8ea5e6641d48a82e5ba3babcc38",".github\u002Fskills\u002Fbackend-tests",559,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvscode-cmake-tools","https:\u002F\u002Faka.ms\u002Fvscode-cmake-tools","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-11 06:52:38",{"source":8,"skillName":5,"commands":76,"prompt":86,"zipAvailable":87},[77,80,83],{"tool":78,"command":79},"npx","npx skills add microsoft\u002Fvscode-cmake-tools --skill backend-tests",{"tool":81,"command":82},"bunx","bunx skills add microsoft\u002Fvscode-cmake-tools --skill backend-tests",{"tool":84,"command":85},"pnpm","pnpm dlx skills add microsoft\u002Fvscode-cmake-tools --skill backend-tests","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvscode-cmake-tools\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fbackend-tests\u002FSKILL.md",true,[],[90,116,133,151,169,186],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":97,"publishedAt":60},"01M69B6J924HHBDH1G30RG9DT3","validation-project","Creates a validation project for testing a specific vscode-cmake-tools pull request. Use this skill when asked to create a validation project, test a PR, validate a pull request, or set up a PR validation environment. The skill creates a structured project directory with documentation, metadata, and checklists for systematically validating PR changes.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvscode-cmake-tools\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fvalidation-project\u002FSKILL.md",[96],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[98,99,100,101,102,59,58,103,104,105,106,107,108,109,110,111,112,51,113,114,45,115,43],"validation project","validation","project","testing","directory","validate","documentation","pr","pull request","cmake","create","pull","SET","Tools","environment","up","with","request",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":123,"publishedAt":60},"01M69B6FDXF7VSNN4VH8MJ2230","presets-vs-kits","Use when writing or reviewing code that must work in both CMake Presets and Kits\u002FVariants modes. Covers configure, build, test, environment, and generator paths. Triggers: \"presets vs kits\", \"useCMakePresets\", \"works in both modes\".","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvscode-cmake-tools\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fpresets-vs-kits\u002FSKILL.md",[122],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[124,42,59,107,55,125,126,112,51,127,50,128,129,130,131,132,43],"presets vs kits","configure","work","build","paths","reviewing code","generator","modes","variants",{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":60},"01M69B6CQT3K9X5HSCQ10ZX54T","pr-readiness","Verify that a pull request into microsoft\u002Fvscode-cmake-tools meets contribution requirements. Use when preparing, reviewing, or finalizing a PR to check for a descriptive title, a meaningful description, a properly formatted CHANGELOG entry, code correctness, regression risks, adherence to existing patterns, and whether documentation updates are needed.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvscode-cmake-tools\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fpr-readiness\u002FSKILL.md",[],[105,140,141,9,58,104,106,107,55,142,109,143,144,51,145,146,147,148,45,149,150,43],"pr readiness","readiness","changelog","regression","check","requirements","contribution","correctness","updates","Existing","title",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":60},"01M69B67VACEFYYR745B6WBF4J","add-setting","Use when adding a new cmake.* configuration setting. Touches package.json (contributes.configuration), package.nls.json, src\u002Fconfig.ts (interface + getter), docs\u002Fcmake-settings.md, and CHANGELOG.md. Triggers: \"add setting\", \"new setting\", \"add configuration\".","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvscode-cmake-tools\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fadd-setting\u002FSKILL.md",[],[158,159,160,161,107,142,162,163,164,165,51,166,50,167,43,168],"add setting","add","docs","config","package","src","json","settings","configuration","interface","new",{"skillNo":170,"name":171,"nameZh":6,"description":172,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":173,"categories":174,"keywords":175,"publishedAt":60},"01M69B64R9S01TGSH17SSHW9V6","add-diagnostic-parser","Use when adding a compiler or tool output parser for the Problems panel. Touches src\u002Fdiagnostics\u002F\u003Cname>.ts, src\u002Fdiagnostics\u002Fbuild.ts, package.json (cmake.enabledOutputParsers), and package.nls.json. Triggers: \"add parser\", \"new diagnostic parser\", \"parse compiler output\".","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvscode-cmake-tools\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fadd-diagnostic-parser\u002FSKILL.md",[],[176,177,159,178,179,180,107,162,181,163,182,51,127,50,183,184,45,185,43,168],"add diagnostic parser","parser","add diagnostic","diagnostic","diagnostics","compiler","tool","panel","output","parse",{"skillNo":187,"name":188,"nameZh":6,"description":189,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":190,"categories":191,"keywords":192,"publishedAt":60},"01M69B622J8838QDVAQMQ0854Z","add-command","Use when adding a new cmake.* command to CMake Tools. Touches package.json (contributes.commands), package.nls.json, src\u002Fextension.ts (funs array), and CHANGELOG.md. Triggers: \"add command\", \"register command\", \"new command palette entry\".","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fvscode-cmake-tools\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fadd-command\u002FSKILL.md",[],[193,194,159,107,195,142,162,111,163,164,51,196,50,197,198,199,200,43,168],"add command","command","command palette","commands","extension","register","palette","entry"]