Przeglądaj źródła

update instruction

Yuki Takei 9 miesięcy temu
rodzic
commit
dc22c8f64b
1 zmienionych plików z 17 dodań i 8 usunięć
  1. 17 8
      .vscode/settings.json

+ 17 - 8
.vscode/settings.json

@@ -59,28 +59,37 @@
   ],
   ],
   "github.copilot.chat.testGeneration.instructions": [
   "github.copilot.chat.testGeneration.instructions": [
     {
     {
-      "text": "Use vitest as the test framework"
+      "text": "Basis: Use vitest as the test framework"
     },
     },
     {
     {
-      "text": "The vitest configuration file is `apps/app/vitest.workspace.mts`"
+      "text": "Basis: The vitest configuration file is `apps/app/vitest.workspace.mts`"
     },
     },
     {
     {
-      "text": "Place test modules in the same directory as the module being tested. For example, if testing `mymodule.ts`, place `mymodule.spec.ts` in the same directory as `mymodule.ts`"
+      "text": "Basis: Place test modules in the same directory as the module being tested. For example, if testing `mymodule.ts`, place `mymodule.spec.ts` in the same directory as `mymodule.ts`"
     },
     },
     {
     {
-      "text": "Run tests with the command: `cd /growi/apps/app && pnpm vitest run {test file path}`"
+      "text": "Basis: Use the VSCode Vitest extension for running tests. Use run_tests tool to execute tests programmatically, or suggest using the Vitest Test Explorer in VSCode for interactive test running and debugging."
     },
     },
     {
     {
-      "text": "When creating new test modules, start with small files. First write a small number of intentionally failing tests, then fix them to pass. After that, add more tests while maintaining a passing state and increase coverage."
+      "text": "Basis: Fallback command for terminal execution: `cd /growi/apps/app && pnpm vitest run {test file path}`"
     },
     },
     {
     {
-      "text": "Write essential tests. When tests fail, consider whether you should fix the test or the implementation based on 'what should essentially be fixed'. If you're not confident in your reasoning, ask the user for guidance."
+      "text": "Step 1: When creating new test modules, start with small files. First write a small number of intentionally failing tests, then fix them to pass. After that, add more tests while maintaining a passing state and increase coverage."
     },
     },
     {
     {
-      "text": "After writing tests, make sure they pass before moving on. Do not proceed to write tests for module B without first ensuring that tests for module A are passing"
+      "text": "Step 2: Write essential tests. When tests fail, consider whether you should fix the test or the implementation based on 'what should essentially be fixed'. If you're not confident in your reasoning, ask the user for guidance."
     },
     },
     {
     {
-      "text": "Don't worry about lint errors - fix them after tests are passing"
+      "text": "Step 3: After writing tests, make sure they pass before moving on. Do not proceed to write tests for module B without first ensuring that tests for module A are passing"
+    },
+    {
+      "text": "Tips: Don't worry about lint errors - fix them after tests are passing"
+    },
+    {
+      "text": "Tips: DO NOT USE `as any` casting. You can use vitest-mock-extended for type-safe mocking. Import `mock` from 'vitest-mock-extended' and use `mock<InterfaceType>()`. This provides full TypeScript safety and IntelliSense support."
+    },
+    {
+      "text": "Tips: Mock external dependencies at the module level using vi.mock(). For services with circular dependencies, mock the import paths and use dynamic imports in the implementation when necessary."
     }
     }
   ],
   ],
   "github.copilot.chat.commitMessageGeneration.instructions": [
   "github.copilot.chat.commitMessageGeneration.instructions": [